Send web mentions in the background
This commit is contained in:
23
lib/adamantium/jobs/send_web_mentions.rb
Normal file
23
lib/adamantium/jobs/send_web_mentions.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require "httparty"
|
||||
require "que"
|
||||
|
||||
module Adamantium
|
||||
module Jobs
|
||||
class SendWebMentions < Que::Job
|
||||
def run(post_content:, post_url:)
|
||||
link_finder = Admin::Container["post_utilities.link_finder"]
|
||||
settings = Admin::Container["settings"]
|
||||
|
||||
source = post_url
|
||||
links = link_finder.call(post_content)
|
||||
links.each do |target|
|
||||
HTTParty.post(settings.webmention_service, {
|
||||
token: settings.webmention_token,
|
||||
source: source,
|
||||
target: target
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user