syndicate to multiple sources

This commit is contained in:
2023-02-18 16:50:56 +11:00
parent 7187f79545
commit e70546bc9c

View File

@@ -15,18 +15,21 @@ module Adamantium
def call(post)
syndicate_to = syndication_targets(post[:syndicate_to])
syndicated_to = []
if syndicate_to.include? :mastodon
url = yield mastodon.call(post: post)
res = mastodon.call(post: post)
Success([:mastodon, url])
syndicated_to << [:mastodon, res.value!] if res.success?
end
if syndicate_to.include? :pinboard
url = yield pinboard.call(post: post)
res = pinboard.call(post: post)
Success([:pinboard, url])
syndicated_to << [:pinboard, res.value!] if res.success?
end
return Success(syndicated_to) unless syndicated_to.empty?
Failure(:no_syndication_targets)
end