A platform for community discussion. Free, open, simple.
FIX: when posts are moved to a message then small action post should not be publicly visible (#7085)
Arpit Jalanc02956e29c40
diff --git a/app/assets/javascripts/discourse/lib/transform-post.js.es6 b/app/assets/javascripts/discourse/lib/transform-post.js.es6index a560d1ba702..c0371aa157e 100644--- a/app/assets/javascripts/discourse/lib/transform-post.js.es6+++ b/app/assets/javascripts/discourse/lib/transform-post.js.es6@@ -114,7 +114,8 @@ export default function transformPost(postAtts.isAutoGenerated = post.is_auto_generated;postAtts.isModeratorAction = postType === postTypes.moderator_action;postAtts.isWhisper = postType === postTypes.whisper;- postAtts.isSmallAction = postType === postTypes.small_action;+ postAtts.isSmallAction =+ postType === postTypes.small_action || post.action_code === "split_topic";postAtts.canBookmark = !!currentUser;postAtts.canManage = currentUser && currentUser.get("canManageTopic");postAtts.canViewRawEmail =diff --git a/app/models/post_mover.rb b/app/models/post_mover.rbindex 47e8790018b..44dfed9b9b7 100644--- a/app/models/post_mover.rb+++ b/app/models/post_mover.rb@@ -208,9 +208,10 @@ class PostMover)end+ post_type = @move_to_pm ? Post.types[:whisper] : Post.types[:small_action]original_topic.add_moderator_post(user, message,- post_type: Post.types[:small_action],+ post_type: post_type,action_code: "split_topic",post_number: @first_post_number_moved)diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rbindex 01dc7cf101a..80e707b25fe 100644--- a/spec/models/post_mover_spec.rb+++ b/spec/models/post_mover_spec.rb@@ -619,7 +619,7 @@ describe PostMover doold_message.reloadmove_message = old_message.posts.find_by(post_number: 2)- expect(move_message.post_type).to eq(Post.types[:small_action])+ expect(move_message.post_type).to eq(Post.types[:whisper])expect(move_message.raw).to include("2 posts were split")endend@@ -662,7 +662,7 @@ describe PostMover doit "uses the correct small action post" domoved_to = personal_message.move_posts(admin, [p2.id], destination_topic_id: another_personal_message.id, archetype: "private_message")- post = Post.find_by(topic_id: personal_message.id, post_type: Post.types[:small_action])+ post = Post.find_by(topic_id: personal_message.id, post_type: Post.types[:whisper])expected_text = I18n.t("move_posts.existing_message_moderator_post",