FIX: Hide ignoring users in preference for users with TL less than a member (#7415)

* FIX: Hide ignoring users in preference for users with TL less than a member
This commit is contained in:
Tarek Khalil 2019-04-23 14:47:37 +01:00 committed by GitHub
parent a2ddb6cf2d
commit dc60128355
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -6,6 +6,8 @@ import User from "discourse/models/user";
export default Ember.Controller.extend(PreferencesTabController, { export default Ember.Controller.extend(PreferencesTabController, {
saveAttrNames: ["muted_usernames", "ignored_usernames"], saveAttrNames: ["muted_usernames", "ignored_usernames"],
ignoredUsernames: Ember.computed.alias("model.ignored_usernames"), ignoredUsernames: Ember.computed.alias("model.ignored_usernames"),
userIsMemberOrAbove: Ember.computed.gte("model.trust_level", 2),
ignoredEnabled: Ember.computed.or("userIsMemberOrAbove", "model.staff"),
actions: { actions: {
ignoredUsernamesChanged(previous, current) { ignoredUsernamesChanged(previous, current) {
if (current.length > previous.length) { if (current.length > previous.length) {

View File

@ -6,14 +6,16 @@
</div> </div>
<div class="instructions">{{i18n 'user.muted_users_instructions'}}</div> <div class="instructions">{{i18n 'user.muted_users_instructions'}}</div>
<div class="controls tracking-controls"> {{#if ignoredEnabled}}
<label>{{d-icon "eye-slash" class="icon"}} {{i18n 'user.ignored_users'}}</label> <div class="controls tracking-controls">
{{user-selector excludeCurrentUser=true <label>{{d-icon "eye-slash" class="icon"}} {{i18n 'user.ignored_users'}}</label>
usernames=model.ignored_usernames {{user-selector excludeCurrentUser=true
onChangeCallback=(action "ignoredUsernamesChanged") usernames=model.ignored_usernames
class="user-selector"}} onChangeCallback=(action "ignoredUsernamesChanged")
</div> class="user-selector"}}
<div class="instructions">{{i18n 'user.ignored_users_instructions'}}</div> </div>
<div class="instructions">{{i18n 'user.ignored_users_instructions'}}</div>
{{/if}}
</div> </div>
{{plugin-outlet name="user-preferences-notifications" args=(hash model=model save=(action "save"))}} {{plugin-outlet name="user-preferences-notifications" args=(hash model=model save=(action "save"))}}