summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Vocella <voxsim@gmail.com>2017-01-01 15:34:53 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2017-02-28 22:15:39 +0000
commit9ce56d2b190ac3d3426c66143255f07f758dc6f8 (patch)
tree86b6905fa360aad58f9657daa98111ea82df8473
parenta3dfb58e7f1b1a3df4a4c16b2d09e50831370a69 (diff)
downloadgitlab-ce-9ce56d2b190ac3d3426c66143255f07f758dc6f8.tar.gz
Add text-warning class in profile settings if the personal_access_token expires soon
-rw-r--r--app/views/profiles/personal_access_tokens/index.html.haml5
-rw-r--r--spec/features/profiles/personal_access_tokens_spec.rb2
2 files changed, 4 insertions, 3 deletions
diff --git a/app/views/profiles/personal_access_tokens/index.html.haml b/app/views/profiles/personal_access_tokens/index.html.haml
index 903b957c26b..e35691d7300 100644
--- a/app/views/profiles/personal_access_tokens/index.html.haml
+++ b/app/views/profiles/personal_access_tokens/index.html.haml
@@ -51,8 +51,9 @@
%td= token.name
%td= token.created_at.to_date.to_s(:medium)
%td
- - if token.expires_at.present?
- = token.expires_at.to_date.to_s(:medium)
+ - if token.expires?
+ %span{ class: ('text-warning' if token.expires_soon?) }
+ In #{distance_of_time_in_words_to_now(token.expires_at)}
- else
%span.personal-access-tokens-never-expires-label Never
%td= token.scopes.present? ? token.scopes.join(", ") : "<no scopes selected>"
diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb
index eb7b8a24669..bce4f7c9f3d 100644
--- a/spec/features/profiles/personal_access_tokens_spec.rb
+++ b/spec/features/profiles/personal_access_tokens_spec.rb
@@ -43,7 +43,7 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
click_on "Create Personal Access Token"
expect(active_personal_access_tokens).to have_text(name)
- expect(active_personal_access_tokens).to have_text(Date.today.next_month.at_beginning_of_month.to_s(:medium))
+ expect(active_personal_access_tokens).to have_text('In')
expect(active_personal_access_tokens).to have_text('api')
expect(active_personal_access_tokens).to have_text('read_user')
end