FIX: only profile owner can see links to watched/tracked/muted topics (#7083)

This commit is contained in:
Maja Komel 2019-02-28 14:58:49 +01:00 committed by Régis Hanol
parent 883a18547e
commit bb5119b88f
2 changed files with 21 additions and 16 deletions

View File

@ -20,12 +20,12 @@ export default Ember.Controller.extend(PreferencesTabController, {
return [].concat(watched, watchedFirst, tracked, muted).filter(t => t);
},
canSave: function() {
return (
this.get("currentUser.id") === this.get("model.id") ||
this.get("currentUser.admin")
);
}.property(),
@computed
canSee() {
return this.get("currentUser.id") === this.get("model.id");
},
canSave: Ember.computed.or("canSee", "currentUser.admin"),
actions: {
save() {

View File

@ -6,18 +6,22 @@
{{category-selector categories=model.watchedCategories blacklist=selectedCategories}}
</div>
<div class="instructions">{{i18n 'user.watched_categories_instructions'}}</div>
{{#if canSee}}
<div class="controls">
<a href="{{unbound model.watchingTopicsPath}}">{{i18n 'user.watched_topics_link'}}</a>
</div>
{{/if}}
<div class="controls category-controls">
<label>{{d-icon "d-tracking"}} {{i18n 'user.tracked_categories'}}</label>
{{category-selector categories=model.trackedCategories blacklist=selectedCategories}}
</div>
<div class="instructions">{{i18n 'user.tracked_categories_instructions'}}</div>
{{#if canSee}}
<div class="controls">
<a href="{{unbound model.trackingTopicsPath}}">{{i18n 'user.tracked_topics_link'}}</a>
</div>
{{/if}}
<div class="controls category-controls">
<label>{{d-icon "d-watching-first"}} {{i18n 'user.watched_first_post_categories'}}</label>
@ -30,10 +34,11 @@
{{category-selector categories=model.mutedCategories blacklist=selectedCategories}}
</div>
<div class="instructions">{{i18n 'user.muted_categories_instructions'}}</div>
{{#if canSee}}
<div class="controls">
<a href="{{unbound model.mutedTopicsPath}}">{{i18n 'user.muted_topics_link'}}</a>
</div>
{{/if}}
</div>
{{plugin-outlet name="user-preferences-categories" args=(hash model=model save=(action "save"))}}