mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Concurrency issues with making topic embedded posts visible
This commit is contained in:
@@ -186,7 +186,6 @@ class PostCreator
|
||||
@post.link_post_uploads
|
||||
update_uploads_secure_status
|
||||
ensure_in_allowed_users if guardian.is_staff?
|
||||
make_visible
|
||||
unarchive_message
|
||||
if !@opts[:import_mode]
|
||||
DraftSequence.next!(@user, draft_key)
|
||||
@@ -415,17 +414,6 @@ class PostCreator
|
||||
end
|
||||
end
|
||||
|
||||
def make_visible
|
||||
return unless SiteSetting.embed_unlisted?
|
||||
return unless @post.post_number > 1
|
||||
return if @post.topic.visible?
|
||||
return if @post.post_type != Post.types[:regular]
|
||||
|
||||
if embed = @post.topic.topic_embed
|
||||
@post.topic.update_status('visible', true, @user)
|
||||
end
|
||||
end
|
||||
|
||||
def unarchive_message
|
||||
return unless @topic.private_message? && @topic.id
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class PostJobsEnqueuer
|
||||
unless skip_after_create?
|
||||
after_post_create
|
||||
after_topic_create
|
||||
make_visible
|
||||
end
|
||||
|
||||
if @topic.private_message?
|
||||
@@ -44,6 +45,17 @@ class PostJobsEnqueuer
|
||||
@post.trigger_post_process(new_post: true)
|
||||
end
|
||||
|
||||
def make_visible
|
||||
return unless SiteSetting.embed_unlisted?
|
||||
return unless @post.post_number > 1
|
||||
return if @topic.visible?
|
||||
return if @post.post_type != Post.types[:regular]
|
||||
|
||||
if @topic.topic_embed.present?
|
||||
Jobs.enqueue(:make_embedded_topic_visible, topic_id: @topic.id)
|
||||
end
|
||||
end
|
||||
|
||||
def after_post_create
|
||||
TopicTrackingState.publish_unread(@post) if @post.post_number > 1
|
||||
TopicTrackingState.publish_latest(@topic, @post.whisper?)
|
||||
|
||||
Reference in New Issue
Block a user