mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Allow passing a category parameter when importing a topic (#14069)
This will be used in the rss pooling plugin to address the feature request at https://meta.discourse.org/t/-/200644?u=falco
This commit is contained in:
committed by
GitHub
parent
823f22ae5e
commit
560c13211a
@@ -27,7 +27,7 @@ class TopicEmbed < ActiveRecord::Base
|
||||
end
|
||||
|
||||
# Import an article from a source (RSS/Atom/Other)
|
||||
def self.import(user, url, title, contents)
|
||||
def self.import(user, url, title, contents, category_id: nil)
|
||||
return unless url =~ /^https?\:\/\//
|
||||
|
||||
if SiteSetting.embed_truncate
|
||||
@@ -58,7 +58,7 @@ class TopicEmbed < ActiveRecord::Base
|
||||
raw: absolutize_urls(url, contents),
|
||||
skip_validations: true,
|
||||
cook_method: cook_method,
|
||||
category: eh.try(:category_id)
|
||||
category: category_id || eh.try(:category_id)
|
||||
}
|
||||
if SiteSetting.embed_unlisted?
|
||||
create_args[:visible] = false
|
||||
|
||||
Reference in New Issue
Block a user