The `isSilenced` and `isSuspended` aliases were useless

We already had `silenced` and `suspended` on the model with the same
effect!
This commit is contained in:
Robin Ward 2018-05-25 10:29:26 -04:00
parent 0ca2a1ce92
commit 3c8369def6
7 changed files with 21 additions and 25 deletions

View File

@ -240,8 +240,6 @@ const AdminUser = Discourse.User.extend({
return this.get('trust_level') < 4;
}.property('trust_level'),
isSuspended: Em.computed.equal('suspended', true),
isSilenced: Ember.computed.equal('silenced', true),
canSuspend: Em.computed.not('staff'),
suspendDuration: function() {

View File

@ -318,18 +318,18 @@
</div>
</div>
<div class="user-suspended display-row {{if model.isSuspended 'highlight-danger'}}">
<div class='field'>{{i18n 'admin.user.suspended'}}</div>
<div class='value'>
{{i18n-yes-no model.isSuspended}}
{{#if model.isSuspended}}
{{#unless model.suspendedForever}}
{{i18n "admin.user.suspended_until" until=model.suspendedTillDate}}
{{/unless}}
{{/if}}
</div>
<div class='controls'>
{{#if model.isSuspended}}
<div class="user-suspended display-row {{if model.suspended 'highlight-danger'}}">
<div class='field'>{{i18n 'admin.user.suspended'}}</div>
<div class='value'>
{{i18n-yes-no model.suspended}}
{{#if model.suspended}}
{{#unless model.suspendedForever}}
{{i18n "admin.user.suspended_until" until=model.suspendedTillDate}}
{{/unless}}
{{/if}}
</div>
<div class='controls'>
{{#if model.suspended}}
{{d-button
class="btn-danger unsuspend-user"
action=(action "unsuspend")
@ -349,7 +349,7 @@
</div>
</div>
{{#if model.isSuspended}}
{{#if model.suspended}}
<div class='display-row highlight-danger suspension-info'>
<div class='field'>{{i18n 'admin.user.suspended_by'}}</div>
<div class='value'>
@ -367,7 +367,7 @@
<div class='field'>{{i18n 'admin.user.silenced'}}</div>
<div class='value'>
{{i18n-yes-no model.silenced}}
{{#if model.isSilenced}}
{{#if model.silenced}}
{{#unless model.silencedForever}}
{{i18n "admin.user.suspended_until" until=model.silencedTillDate}}
{{/unless}}
@ -394,7 +394,7 @@
</div>
</div>
{{#if model.isSilenced}}
{{#if model.silenced}}
<div class='display-row highlight-danger silence-info'>
<div class='field'>{{i18n 'admin.user.silenced_by'}}</div>
<div class='value'>
@ -408,6 +408,7 @@
</div>
{{/if}}
</section>
{{#if currentUser.admin}}

View File

@ -18,7 +18,6 @@ export default Ember.Component.extend(CardContentsBase, CanCheckEmails, CleansUp
showFilter: Ember.computed.and('viewingTopic', 'postStream.hasNoFilters', 'enoughPostsForFiltering'),
showName: propertyNotEqual('user.name', 'user.username'),
hasUserFilters: Ember.computed.gt('postStream.userFilters.length', 0),
isSuspended: Ember.computed.notEmpty('user.suspend_reason'),
showMoreBadges: Ember.computed.gt('moreBadgesCount', 0),
showDelete: Ember.computed.and("viewingAdmin", "showName", "user.canBeDeleted"),
linkWebsite: Ember.computed.not('user.isBasic'),

View File

@ -39,9 +39,9 @@ export default Ember.Controller.extend(CanCheckEmails, {
showStaffCounters: Ember.computed.or('hasGivenFlags', 'hasFlaggedPosts', 'hasDeletedPosts', 'hasBeenSuspended', 'hasReceivedWarnings'),
@computed('model.isSuspended', 'currentUser.staff')
isNotSuspendedOrIsStaff(isSuspended, isStaff) {
return !isSuspended || isStaff;
@computed('model.suspended', 'currentUser.staff')
isNotSuspendedOrIsStaff(suspended, isStaff) {
return !suspended || isStaff;
},
linkWebsite: Em.computed.not('model.isBasic'),

View File

@ -169,8 +169,6 @@ const User = RestModel.extend({
isElder: Em.computed.equal('trust_level', 4),
canManageTopic: Em.computed.or('staff', 'isElder'),
isSuspended: Em.computed.equal('suspended', true),
@computed("previous_visit_at")
previousVisitAt(previous_visit_at) {
return new Date(previous_visit_at);

View File

@ -84,7 +84,7 @@
args=(hash user=user close=(action "close"))
tagName=""}}
{{#if isSuspended}}
{{#if user.suspend_reason}}
<div class='suspended'>
{{d-icon "ban"}}
<b>{{i18n 'user.suspended_notice' date=user.suspendedTillDate}}</b><br>

View File

@ -107,7 +107,7 @@
</h3>
<div class='bio'>
{{#if model.isSuspended}}
{{#if model.suspended}}
<div class='suspended'>
{{d-icon "ban"}}
<b>