From 14a5cbeec08c1b12514bd417a93545daeac93455 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sun, 29 Jan 2023 13:24:57 +1100 Subject: [PATCH] Add logging to mastodon Syndicating --- lib/adamantium/syndication/mastodon.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/adamantium/syndication/mastodon.rb b/lib/adamantium/syndication/mastodon.rb index 985e290..b552095 100644 --- a/lib/adamantium/syndication/mastodon.rb +++ b/lib/adamantium/syndication/mastodon.rb @@ -14,7 +14,7 @@ module Adamantium return Failure(:no_mastodon_credentials) end - text = post[:name] + text = (post[:name] != "") ? post[:name] : post[:content] text_with_link = "#{text} — #{settings.micropub_site_url}" tags = post[:category].map { |tag| "##{tag}" }.join(" ") text_with_tags = "#{text_with_link} #{tags}" @@ -23,6 +23,8 @@ module Adamantium mastodon_token = settings.mastodon_token mastodon_server = settings.mastodon_server.split("@").first + logger.info("Syndicating to: #{mastodon_server}api/v1/statuses") + response = HTTParty.post("#{mastodon_server}api/v1/statuses", { headers: { "Idempotency-Key": key,