Commit 9ce56d2b authored by Simon Vocella's avatar Simon Vocella Committed by Tiago Botelho

Add text-warning class in profile settings if the personal_access_token expires soon

parent a3dfb58e
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
%td= token.name %td= token.name
%td= token.created_at.to_date.to_s(:medium) %td= token.created_at.to_date.to_s(:medium)
%td %td
- if token.expires_at.present? - if token.expires?
= token.expires_at.to_date.to_s(:medium) %span{ class: ('text-warning' if token.expires_soon?) }
In #{distance_of_time_in_words_to_now(token.expires_at)}
- else - else
%span.personal-access-tokens-never-expires-label Never %span.personal-access-tokens-never-expires-label Never
%td= token.scopes.present? ? token.scopes.join(", ") : "<no scopes selected>" %td= token.scopes.present? ? token.scopes.join(", ") : "<no scopes selected>"
......
...@@ -43,7 +43,7 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do ...@@ -43,7 +43,7 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
click_on "Create Personal Access Token" click_on "Create Personal Access Token"
expect(active_personal_access_tokens).to have_text(name) 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('api')
expect(active_personal_access_tokens).to have_text('read_user') expect(active_personal_access_tokens).to have_text('read_user')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment