Skip to content

Commit

Permalink
Merge pull request #49 from usegalaxy-eu/fix-content-composition
Browse files Browse the repository at this point in the history
Don't accumulate newlines on missing mentions/hashtags
  • Loading branch information
wm75 authored Jun 18, 2024
2 parents dd0eb9a + 094e2f4 commit 50f76db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/plugins/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ def format_content(self, content, mentions, hashtags, images, **kwargs):
else:
warnings = ""

chunks = self.wrap_text_with_index(f"{content}\n\n{mentions}\n{hashtags}")
content += "\n"
if mentions:
content = f"{content}\n{mentions}"
if hashtags:
content = f"{content}\n{hashtags}"
chunks = self.wrap_text_with_index(content.strip("\n"))

formatted_content = {
"body": "\n\n".join(chunks),
Expand Down
7 changes: 6 additions & 1 deletion lib/plugins/mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def format_content(self, content, mentions, hashtags, images, **kwargs):
else:
warnings = ""

chunks = self.wrap_text_with_index(f"{content}\n\n{mentions}\n{hashtags}")
content += "\n"
if mentions:
content = f"{content}\n{mentions}"
if hashtags:
content = f"{content}\n{hashtags}"
chunks = self.wrap_text_with_index(content.strip("\n"))

formatted_content = {
"body": "\n\n".join(chunks),
Expand Down

0 comments on commit 50f76db

Please sign in to comment.