Public user profile page shows if the user is suspended and why.

This commit is contained in:
Neil Lalonde 2013-11-07 16:34:18 -05:00
parent ac9a763ab3
commit dbd2332b74
6 changed files with 42 additions and 5 deletions

View File

@ -2,9 +2,9 @@
<form>
{{i18n admin.user.suspend_duration}}
{{textField value=duration maxlength="5" autofocus="autofocus" class="span2"}}
{{i18n admin.user.suspend_duration_units}}
{{i18n admin.user.suspend_duration_units}}<br/>
<br/>
{{i18n admin.user.suspend_reason_label}}
{{{i18n admin.user.suspend_reason_label}}}<br/>
<br/>
{{textField value=reason class="span8"}}
</form>

View File

@ -97,6 +97,12 @@ Discourse.User = Discourse.Model.extend({
return Discourse.Site.currentProp('trustLevels').findProperty('id', parseInt(this.get('trust_level'), 10));
}.property('trust_level'),
isSuspended: Em.computed.equal('suspended', true),
suspendedTillDate: function() {
return Discourse.Formatter.longDate(this.get('suspended_till'));
}.property('suspended_till'),
/**
Changes this user's username.

View File

@ -42,6 +42,14 @@
<h2>{{name}}</h2>
<div class='bio'>{{{bio_excerpt}}}</div>
{{#if isSuspended}}
<div class='suspended'>
<i class='icon icon-ban-circle'></i>
<b>{{i18n user.suspended_notice date="suspendedTillDate"}}</b><br/>
<b>{{i18n user.suspended_reason}}</b> {{suspend_reason}}
</div>
{{/if}}
</div>
<div class='secondary'>

View File

@ -166,6 +166,10 @@
background-color: white;
}
.suspended {
color: #f77;
}
.primary {
margin-top: 20px;
float: left;

View File

@ -17,7 +17,10 @@ class UserSerializer < BasicUserSerializer
:trust_level,
:moderator,
:admin,
:title
:title,
:suspended,
:suspend_reason,
:suspended_till
has_one :invited_by, embed: :object, serializer: BasicUserSerializer
@ -96,4 +99,18 @@ class UserSerializer < BasicUserSerializer
SiteSetting.enable_names?
end
def suspended
object.suspended?
end
def include_suspended?
object.suspended?
end
def include_suspend_reason?
object.suspended?
end
def include_suspended_till?
object.suspended?
end
end

View File

@ -216,6 +216,8 @@ en:
moderator: "{{user}} is a moderator"
admin: "{{user}} is an admin"
deleted: "(deleted)"
suspended_notice: "This user is suspended until {{date}}."
suspended_reason: "Reason: "
messages:
all: "All"
@ -1339,9 +1341,9 @@ en:
user:
suspend_failed: "Something went wrong suspending this user {{error}}"
unsuspend_failed: "Something went wrong unsuspending this user {{error}}"
suspend_duration: "How long would you like to suspend the user for?"
suspend_duration: "How long will the user be suspended for?"
suspend_duration_units: "(days)"
suspend_reason_label: "Why are you suspending? When the user tries to log in, they will see this text. Keep it short."
suspend_reason_label: "Why are you suspending? This text <b>will be visible to everyone</b> on this user's profile page, and will be shown to the user when they try to log in. Keep it short."
suspend_reason: "Reason"
suspended_by: "Suspended by"
delete_all_posts: "Delete all posts"