diff --git a/app/assets/javascripts/discourse/components/utilities.js b/app/assets/javascripts/discourse/components/utilities.js index 478bd1d297e..ce308a7db2e 100644 --- a/app/assets/javascripts/discourse/components/utilities.js +++ b/app/assets/javascripts/discourse/components/utilities.js @@ -78,6 +78,10 @@ Discourse.Utilities = { (extraClasses || "") + "' title='" + (Handlebars.Utils.escapeExpression(title || "")) + "'>"; }, + tinyAvatar: function(username) { + return Discourse.Utilities.avatarImg({ username: username, size: 'tiny' }); + }, + postUrl: function(slug, topicId, postNumber) { var url; url = "/t/"; diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js index 9f7fdb2f064..201d24df01d 100644 --- a/app/assets/javascripts/discourse/models/composer.js +++ b/app/assets/javascripts/discourse/models/composer.js @@ -112,12 +112,24 @@ Discourse.Composer = Discourse.Model.extend({ topicLink = " " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + ""; } - var replyAvatar; - if (this.get('post')) { - replyAvatar = Discourse.Utilities.avatarImg({ - username: this.get('post.username'), - size: 'tiny' + var postDescription, + post = this.get('post'); + + if (post) { + + postDescription = Em.String.i18n('post.' + this.get('action'), { + link: postLink, + replyAvatar: Discourse.Utilities.tinyAvatar(post.get('username')), + username: this.get('post.username') }); + + var replyUsername = post.get('reply_to_user.username'); + if (replyUsername && this.get('action') === EDIT) { + postDescription += " " + Em.String.i18n("post.in_reply_to") + " " + + Discourse.Utilities.tinyAvatar(replyUsername) + " " + replyUsername; + } + + } switch (this.get('action')) { @@ -127,15 +139,8 @@ Discourse.Composer = Discourse.Model.extend({ return Em.String.i18n('topic.create_long'); case REPLY: case EDIT: - if (replyAvatar) { - return Em.String.i18n('post.' + this.get('action'), { - link: postLink, - replyAvatar: replyAvatar, - username: this.get('post.username') - }); - } else if (topic) { - return Em.String.i18n('post.reply_topic', { link: topicLink }); - } + if (postDescription) return postDescription; + if (topic) return Em.String.i18n('post.reply_topic', { link: topicLink }); } }).property('action', 'post', 'topic', 'topic.title'),