Skip to content

Commit

Permalink
Fix maxed-out invites not showing up as expired in UI (mastodon#10274)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 4b873c9 commit f79e432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions app/views/admin/invites/_invite.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
= image_tag invite.user.account.avatar.url(:original), alt: '', width: 16, height: 16, class: 'avatar'
%span.username= invite.user.account.username

- if invite.expired?
%td{ colspan: 2 }
= t('invites.expired')
- else
- if invite.valid_for_use?
%td
= fa_icon 'user fw'
= invite.uses
Expand All @@ -24,6 +21,10 @@
- else
%time.formatted{ datetime: invite.expires_at.iso8601, title: l(invite.expires_at) }
= l invite.expires_at
- else
%td{ colspan: 2 }
= t('invites.expired')

%td
- if !invite.expired? && policy(invite).destroy?
- if invite.valid_for_use? && policy(invite).destroy?
= table_link_to 'times', t('invites.delete'), admin_invite_path(invite), method: :delete
10 changes: 5 additions & 5 deletions app/views/invites/_invite.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
%input{ type: :text, maxlength: '999', spellcheck: 'false', readonly: 'true', value: public_invite_url(invite_code: invite.code) }
%button{ type: :button }= t('generic.copy')

- if invite.expired?
%td{ colspan: 2 }
= t('invites.expired')
- else
- if invite.valid_for_use?
%td
= fa_icon 'user fw'
= invite.uses
Expand All @@ -19,7 +16,10 @@
- else
%time.formatted{ datetime: invite.expires_at.iso8601, title: l(invite.expires_at) }
= l invite.expires_at
- else
%td{ colspan: 2 }
= t('invites.expired')

%td
- if !invite.expired? && policy(invite).destroy?
- if invite.valid_for_use? && policy(invite).destroy?
= table_link_to 'times', t('invites.delete'), invite_path(invite), method: :delete

0 comments on commit f79e432

Please sign in to comment.