2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-12-31 14:37:43 -05:00
|
|
|
module Jobs
|
|
|
|
# Asynchronously retrieve a topic from an embedded site
|
2019-10-02 00:01:53 -04:00
|
|
|
class RetrieveTopic < ::Jobs::Base
|
2013-12-31 14:37:43 -05:00
|
|
|
def execute(args)
|
2024-05-27 06:27:13 -04:00
|
|
|
raise Discourse::InvalidParameters.new(:embed_url) if args[:embed_url].blank?
|
2013-12-31 14:37:43 -05:00
|
|
|
|
|
|
|
user = nil
|
2014-05-06 09:41:59 -04:00
|
|
|
user = User.find_by(id: args[:user_id]) if args[:user_id]
|
2014-04-24 12:48:45 -04:00
|
|
|
TopicRetriever.new(
|
|
|
|
args[:embed_url],
|
|
|
|
author_username: args[:author_username],
|
|
|
|
no_throttle: user.try(:staff?),
|
|
|
|
).retrieve
|
2013-12-31 14:37:43 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|