FIX: Only show the full suspension reason on the admin side

This commit is contained in:
Robin Ward 2017-12-07 13:20:42 -05:00
parent 02431d4af1
commit 4ae1bbaeba
4 changed files with 15 additions and 3 deletions

View File

@ -342,7 +342,7 @@
</div>
<div class='controls'>
<b>{{i18n 'admin.user.suspend_reason'}}</b>:
{{model.suspend_reason}}
<div class='full-suspend-reason'>{{model.full_suspend_reason}}</div>
</div>
</div>
{{/if}}

View File

@ -177,6 +177,10 @@ $mobile-breakpoint: 700px;
}
}
.full-suspend-reason {
white-space: pre-wrap;
}
.admin-users .users-list {
.username .fa {
color: dark-light-choose($primary-medium, $secondary-medium);

View File

@ -684,8 +684,16 @@ class User < ActiveRecord::Base
UserHistory.for(self, :suspend_user).order('id DESC').first
end
def full_suspend_reason
return suspend_record.try(:details) if suspended?
end
def suspend_reason
suspend_record.try(:details) if suspended?
if details = full_suspend_reason
return details.split("\n")[0]
end
nil
end
# Use this helper to determine if the user has a particular trust level.

View File

@ -16,7 +16,7 @@ class AdminDetailedUserSerializer < AdminUserSerializer
:can_delete_all_posts,
:can_be_deleted,
:can_be_anonymized,
:suspend_reason,
:full_suspend_reason,
:suspended_till,
:silence_reason,
:primary_group_id,