FIX: Private Message link was broken

This commit is contained in:
Robin Ward 2013-10-03 15:41:38 -04:00
parent f6afbcfb3a
commit 88476800f8
3 changed files with 18 additions and 8 deletions

View File

@ -14,13 +14,15 @@ Discourse.UserActivityController = Discourse.ObjectController.extend({
(this.get('userActionType') === Discourse.UserAction.TYPES.messages_received);
}.property('userActionType'),
composePrivateMessage: function() {
return this.get('controllers.composer').open({
action: Discourse.Composer.PRIVATE_MESSAGE,
usernames: this.get('model.username'),
archetypeId: 'private_message',
draftKey: 'new_private_message'
});
actions: {
composePrivateMessage: function() {
return this.get('controllers.composer').open({
action: Discourse.Composer.PRIVATE_MESSAGE,
usernames: this.get('model.username'),
archetypeId: 'private_message',
draftKey: 'new_private_message'
});
}
},
privateMessagesActive: Em.computed.equal('pmView', 'index'),

View File

@ -21,6 +21,14 @@ Discourse.TopicRoute = Discourse.Route.extend({
});
},
composePrivateMessage: function(user) {
var self = this;
Discourse.URL.routeTo("/users/" + user.get('username_lower') + "/private-messages").then(function () {
self.controllerFor('userActivity').send('composePrivateMessage')
});
},
showFlags: function(post) {
Discourse.Route.showModal(this, 'flag', post);
this.controllerFor('flag').setProperties({ selected: null });

View File

@ -8,7 +8,7 @@
<div class='bottom'>
{{#if bio_cooked}}<div class='bio'>{{{bio_cooked}}}</div>{{/if}}
<button class='btn'><i class='icon icon-envelope'></i>{{i18n user.private_message}}</button>
<button class='btn' {{action composePrivateMessage model}}><i class='icon icon-envelope'></i>{{i18n user.private_message}}</button>
{{#link-to 'user' model class="btn"}}<i class='icon icon-user'></i>{{i18n user.profile}}{{/link-to}}