diff --git a/app/models/user.rb b/app/models/user.rb index 5bdd3fc0..c6e68b10 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/modal/_ban.haml b/app/views/modal/_ban.haml index e532c822..6bf8c900 100644 --- a/app/views/modal/_ban.haml +++ b/app/views/modal/_ban.haml @@ -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