mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: If editing a reply, the quote button should target the post it was
a reply to, not the post you're editing.
This commit is contained in:
parent
c410da4f7f
commit
dc260110fa
1 changed files with 18 additions and 1 deletions
|
@ -305,8 +305,25 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
importQuote: function() {
|
importQuote: function() {
|
||||||
|
var postStream = this.get('topic.postStream'),
|
||||||
|
postId = this.get('post.id');
|
||||||
|
|
||||||
|
if (!postId && postStream) {
|
||||||
|
postId = postStream.get('firstPostId');
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're editing a post, fetch the reply when importing a quote
|
||||||
|
if (this.get('editingPost')) {
|
||||||
|
var replyToPostNumber = this.get('post.reply_to_post_number');
|
||||||
|
if (replyToPostNumber) {
|
||||||
|
var replyPost = postStream.get('posts').findBy('post_number', replyToPostNumber);
|
||||||
|
if (replyPost) {
|
||||||
|
postId = replyPost.get('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If there is no current post, use the post id from the stream
|
// If there is no current post, use the post id from the stream
|
||||||
var postId = this.get('post.id') || this.get('topic.postStream.firstPostId');
|
|
||||||
if (postId) {
|
if (postId) {
|
||||||
this.set('loading', true);
|
this.set('loading', true);
|
||||||
var composer = this;
|
var composer = this;
|
||||||
|
|
Loading…
Reference in a new issue