mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Apply embed unlisted setting consistently (#24294)
Applies the embed_unlisted site setting consistently across topic embeds, including those created via the WP Discourse plugin. Relatedly, adds a embed exception to can_create_unlisted_topic? check. Users creating embedded topics are not always staff.
This commit is contained in:
@@ -72,19 +72,11 @@ class TopicEmbed < ActiveRecord::Base
|
||||
cook_method: cook_method,
|
||||
category: category_id || eh.try(:category_id),
|
||||
tags: SiteSetting.tagging_enabled ? tags : nil,
|
||||
embed_url: url,
|
||||
embed_content_sha1: content_sha1,
|
||||
}
|
||||
create_args[:visible] = false if SiteSetting.embed_unlisted?
|
||||
|
||||
creator = PostCreator.new(user, create_args)
|
||||
post = creator.create
|
||||
if post.present?
|
||||
TopicEmbed.create!(
|
||||
topic_id: post.topic_id,
|
||||
embed_url: url,
|
||||
content_sha1: content_sha1,
|
||||
post_id: post.id,
|
||||
)
|
||||
end
|
||||
post = PostCreator.create(user, create_args)
|
||||
end
|
||||
else
|
||||
absolutize_urls(url, contents)
|
||||
|
||||
Reference in New Issue
Block a user