2013-12-31 13:37:43 -06:00
|
|
|
require_dependency 'email/sender'
|
|
|
|
require_dependency 'topic_retriever'
|
|
|
|
|
|
|
|
module Jobs
|
|
|
|
|
|
|
|
# Asynchronously retrieve a topic from an embedded site
|
|
|
|
class RetrieveTopic < Jobs::Base
|
|
|
|
|
|
|
|
def execute(args)
|
|
|
|
raise Discourse::InvalidParameters.new(:embed_url) unless args[:embed_url].present?
|
|
|
|
|
|
|
|
user = nil
|
|
|
|
if args[:user_id]
|
2014-05-06 08:41:59 -05:00
|
|
|
user = User.find_by(id: args[:user_id])
|
2013-12-31 13:37:43 -06:00
|
|
|
end
|
2014-04-24 11:48:45 -05:00
|
|
|
TopicRetriever.new(args[:embed_url], author_username: args[:author_username], no_throttle: user.try(:staff?)).retrieve
|
2013-12-31 13:37:43 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|