Add `permanently_banned?` method to user model
This commit is contained in:
parent
cd168df9b2
commit
73274988c1
|
@ -229,6 +229,10 @@ class User < ApplicationRecord
|
|||
end
|
||||
# endregion
|
||||
|
||||
def permanently_banned?
|
||||
bans.current.first&.permanent? || false
|
||||
end
|
||||
|
||||
def banned?
|
||||
self.bans.current.count > 0
|
||||
end
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
.modal-body
|
||||
= f.check_box :ban, label: t('views.modal.bancontrol.ban'), checked: user.banned?
|
||||
#ban-controls{ class: user.banned? ? '' : 'd-none' }
|
||||
= f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: user.permanent?
|
||||
#ban-controls-time{ class: user.permanent? ? 'd-none' : '' }
|
||||
= f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: user.permanently_banned?
|
||||
#ban-controls-time{ class: user.permanently_banned? ? 'd-none' : '' }
|
||||
= f.text_field :duration, label: '', required: true
|
||||
.form-check.form-check-inline
|
||||
= f.radio_button :duration_unit, 'hours', label: 'Hours', checked: true
|
||||
|
|
Loading…
Reference in New Issue