FIX: hide bookmarks tab on other peoples profile (unless self or admin)

FIX: missing download my posts button
FIX: moderators had no way of seeing responses and edits etc
This commit is contained in:
Sam 2015-12-31 15:05:23 +11:00
parent cba76db53b
commit 01281b6364
7 changed files with 30 additions and 7 deletions

View File

@ -1,6 +1,9 @@
export default Ember.Controller.extend({
userActionType: null,
needs: ["application"],
needs: ["application", "user"],
viewingSelf: Em.computed.alias("controllers.user.viewingSelf"),
showBookmarks: Em.computed.alias("controllers.user.showBookmarks"),
_showFooter: function() {
var showFooter;

View File

@ -26,14 +26,19 @@ export default Ember.Controller.extend(CanCheckEmails, {
return trustLevel > 2 && !this.siteSettings.tl3_links_no_follow;
},
@computed('viewingSelf', 'currentUser.admin')
showBookmarks(viewingSelf, isAdmin) {
return viewingSelf || isAdmin;
},
@computed('viewingSelf', 'currentUser.admin')
showPrivateMessages(viewingSelf, isAdmin) {
return this.siteSettings.enable_private_messages && (viewingSelf || isAdmin);
},
@computed('viewingSelf', 'currentUser.admin')
canSeeNotificationHistory(viewingSelf, isAdmin) {
return viewingSelf || isAdmin;
@computed('viewingSelf', 'currentUser.staff')
showNotificationsTab(viewingSelf, staff) {
return viewingSelf || staff;
},
@computed("content.badge_count")

View File

@ -2,5 +2,11 @@ export default Discourse.Route.extend({
controllerName: 'user-notifications',
renderTemplate() {
this.render("user/notifications-index");
}
},
afterModel(model){
if (!model) {
this.transitionTo('userNotifications.responses');
}
},
});

View File

@ -14,9 +14,14 @@ export default Discourse.Route.extend(ViewingActionType, {
},
model() {
return this.store.find("notification", { username: this.modelFor("user").get("username") });
const username = this.modelFor("user").get("username");
if (this.get("currentUser.username") === username || this.get("currentUser.admin")) {
return this.store.find("notification", { username } );
}
},
setupController(controller, model) {
controller.set("model", model);
controller.set("user", this.modelFor("user"));

View File

@ -21,11 +21,13 @@
{{/link-to}}
</li>
{{#if showBookmarks}}
<li>
{{#link-to 'userActivity.bookmarks'}}
<i class="glyph fa fa-bookmark"></i>{{i18n 'user_action_groups.3'}}
{{/link-to}}
</li>
{{/if}}
</ul>
{{#if viewingSelf}}

View File

@ -1,9 +1,11 @@
<section class='user-navigation'>
<ul class='action-list nav-stacked'>
{{#if model}}
<li class='no-glyph'>
{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
</li>
{{/if}}
<li>
{{#link-to 'userNotifications.responses'}}
<i class="glyph fa fa-reply"></i>

View File

@ -150,7 +150,7 @@
<ul class="nav nav-pills user-nav">
<li class='selected'>{{#link-to 'userActivity'}}{{i18n 'user.activity_stream'}}{{/link-to}}</li>
{{#if canSeeNotificationHistory}}
{{#if showNotificationsTab}}
<li>
{{#link-to 'userNotifications'}}
{{fa-icon "comment" class="glyph"}}