FIX: only show "new pm" in pm tab when looking at your own profile

This commit is contained in:
Sam 2014-12-04 13:50:24 +11:00
parent 4aa0d88c6c
commit 8f4e8fe8f2
2 changed files with 8 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import ObjectController from 'discourse/controllers/object';
// Lists of topics on a user's page. // Lists of topics on a user's page.
export default ObjectController.extend(Discourse.HasCurrentUser, { export default ObjectController.extend(Discourse.HasCurrentUser, {
needs: ["application"], needs: ["application", "user"],
hideCategory: false, hideCategory: false,
showParticipants: false, showParticipants: false,
@ -14,6 +14,11 @@ export default ObjectController.extend(Discourse.HasCurrentUser, {
loadMore: function() { loadMore: function() {
this.get('model').loadMore(); this.get('model').loadMore();
} }
} },
showNewPM: function(){
return this.get('controllers.user.viewingSelf') &&
Discourse.User.currentProp('can_send_private_messages');
}.property('controllers.user.viewingSelf'),
}); });

View File

@ -1,4 +1,4 @@
{{#if currentUser.can_send_private_messages}} {{#if showNewPM}}
<div class="clearfix"> <div class="clearfix">
<a class='btn btn-primary pull-right new-private-message' {{action "composePrivateMessage"}}>{{fa-icon "envelope"}}{{i18n user.new_private_message}}</a> <a class='btn btn-primary pull-right new-private-message' {{action "composePrivateMessage"}}>{{fa-icon "envelope"}}{{i18n user.new_private_message}}</a>
</div> </div>