Fixed Mastodon code

Pls check hashtags variable since I think code is correct but tags are not passed to the web service. Thks!
This commit is contained in:
Maurizio Paglia 2022-12-28 11:39:26 +01:00 committed by GitHub
commit db31937745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,10 +57,16 @@ def create_link_facebook(title, url, content):
@create_link
def create_link_mastodon(title, url, content):
tags = getattr(content, "tags", [])
tags = ", ".join([tag.slug for tag in tags])
hashtags = f"&hashtags={tags}" if tags else ""
return f"https://toot.kytta.dev/?text={title}&url={url}{hashtags}"
if hasattr(content, 'tags'):
taglist = content.tags
new_taglist = []
for i in taglist:
new_taglist.append('#' + str(i))
hashtags = ' '.join(str(x).replace(" ", "") for x in new_taglist)
else:
hashtags = ''
return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}"
@create_link