Fix share URL for first post

This commit is contained in:
Sam 2013-07-16 15:41:43 +10:00
parent ecf17cfebb
commit a3155858a0
1 changed files with 7 additions and 2 deletions

View File

@ -9,9 +9,14 @@
Discourse.Post = Discourse.Model.extend({ Discourse.Post = Discourse.Model.extend({
shareUrl: function() { shareUrl: function() {
if (this.get('firstPost')) return this.get('topic.url');
var user = Discourse.User.current(); var user = Discourse.User.current();
return this.get('url') + (user ? '?u=' + user.get('username_lower') : ''); var userSuffix = user ? '?u=' + user.get('username_lower') : '';
if (this.get('firstPost')) {
return this.get('topic.url') + userSuffix;
} else {
return this.get('url') + userSuffix ;
}
}.property('url'), }.property('url'),
new_user: Em.computed.equal('trust_level', 0), new_user: Em.computed.equal('trust_level', 0),