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:
parent
cba76db53b
commit
01281b6364
|
@ -1,6 +1,9 @@
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
userActionType: null,
|
userActionType: null,
|
||||||
needs: ["application"],
|
needs: ["application", "user"],
|
||||||
|
|
||||||
|
viewingSelf: Em.computed.alias("controllers.user.viewingSelf"),
|
||||||
|
showBookmarks: Em.computed.alias("controllers.user.showBookmarks"),
|
||||||
|
|
||||||
_showFooter: function() {
|
_showFooter: function() {
|
||||||
var showFooter;
|
var showFooter;
|
||||||
|
|
|
@ -26,14 +26,19 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||||
return trustLevel > 2 && !this.siteSettings.tl3_links_no_follow;
|
return trustLevel > 2 && !this.siteSettings.tl3_links_no_follow;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@computed('viewingSelf', 'currentUser.admin')
|
||||||
|
showBookmarks(viewingSelf, isAdmin) {
|
||||||
|
return viewingSelf || isAdmin;
|
||||||
|
},
|
||||||
|
|
||||||
@computed('viewingSelf', 'currentUser.admin')
|
@computed('viewingSelf', 'currentUser.admin')
|
||||||
showPrivateMessages(viewingSelf, isAdmin) {
|
showPrivateMessages(viewingSelf, isAdmin) {
|
||||||
return this.siteSettings.enable_private_messages && (viewingSelf || isAdmin);
|
return this.siteSettings.enable_private_messages && (viewingSelf || isAdmin);
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed('viewingSelf', 'currentUser.admin')
|
@computed('viewingSelf', 'currentUser.staff')
|
||||||
canSeeNotificationHistory(viewingSelf, isAdmin) {
|
showNotificationsTab(viewingSelf, staff) {
|
||||||
return viewingSelf || isAdmin;
|
return viewingSelf || staff;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("content.badge_count")
|
@computed("content.badge_count")
|
||||||
|
|
|
@ -2,5 +2,11 @@ export default Discourse.Route.extend({
|
||||||
controllerName: 'user-notifications',
|
controllerName: 'user-notifications',
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
this.render("user/notifications-index");
|
this.render("user/notifications-index");
|
||||||
}
|
},
|
||||||
|
|
||||||
|
afterModel(model){
|
||||||
|
if (!model) {
|
||||||
|
this.transitionTo('userNotifications.responses');
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,9 +14,14 @@ export default Discourse.Route.extend(ViewingActionType, {
|
||||||
},
|
},
|
||||||
|
|
||||||
model() {
|
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) {
|
setupController(controller, model) {
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
controller.set("user", this.modelFor("user"));
|
controller.set("user", this.modelFor("user"));
|
||||||
|
|
|
@ -21,11 +21,13 @@
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{{#if showBookmarks}}
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userActivity.bookmarks'}}
|
{{#link-to 'userActivity.bookmarks'}}
|
||||||
<i class="glyph fa fa-bookmark"></i>{{i18n 'user_action_groups.3'}}
|
<i class="glyph fa fa-bookmark"></i>{{i18n 'user_action_groups.3'}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{#if viewingSelf}}
|
{{#if viewingSelf}}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
|
||||||
<section class='user-navigation'>
|
<section class='user-navigation'>
|
||||||
<ul class='action-list nav-stacked'>
|
<ul class='action-list nav-stacked'>
|
||||||
|
{{#if model}}
|
||||||
<li class='no-glyph'>
|
<li class='no-glyph'>
|
||||||
{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
|
{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
{{/if}}
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userNotifications.responses'}}
|
{{#link-to 'userNotifications.responses'}}
|
||||||
<i class="glyph fa fa-reply"></i>
|
<i class="glyph fa fa-reply"></i>
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
|
|
||||||
<ul class="nav nav-pills user-nav">
|
<ul class="nav nav-pills user-nav">
|
||||||
<li class='selected'>{{#link-to 'userActivity'}}{{i18n 'user.activity_stream'}}{{/link-to}}</li>
|
<li class='selected'>{{#link-to 'userActivity'}}{{i18n 'user.activity_stream'}}{{/link-to}}</li>
|
||||||
{{#if canSeeNotificationHistory}}
|
{{#if showNotificationsTab}}
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userNotifications'}}
|
{{#link-to 'userNotifications'}}
|
||||||
{{fa-icon "comment" class="glyph"}}
|
{{fa-icon "comment" class="glyph"}}
|
||||||
|
|
Loading…
Reference in New Issue