FIX: ensures we don't attempt to create a new PM on an existing topic (#9029)

This fix attempts to both fix it at UI level and server side. A previous attempt related to this behavior has been made in commit: 49c750ca78
This commit is contained in:
Joffrey JAFFEUX
2020-02-24 15:55:12 +01:00
committed by GitHub
parent 31f3ed8d36
commit 0ea11a9d49
6 changed files with 35 additions and 5 deletions

View File

@ -176,12 +176,12 @@ module DiscourseNarrativeBot
if @post &&
@post.topic.private_message? &&
@post.topic.topic_allowed_users.pluck(:user_id).include?(@user.id)
opts = opts.merge(topic_id: @post.topic_id)
end
if @data[:topic_id]
opts = opts.merge(topic_id: @data[:topic_id])
opts = opts
.merge(topic_id: @data[:topic_id])
.except(:title, :target_usernames, :archetype)
end
post = reply_to(@post, raw, opts)

View File

@ -208,7 +208,9 @@ module DiscourseNarrativeBot
end
if @data[:topic_id]
opts = opts.merge(topic_id: @data[:topic_id])
opts = opts
.merge(topic_id: @data[:topic_id])
.except(:title, :target_usernames, :archetype)
end
post = reply_to(@post, raw, opts)