Skip to content

Commit

Permalink
Show error if trying to boost unboostables in TUI
Browse files Browse the repository at this point in the history
  • Loading branch information
limdingwen authored and ihabunek committed Dec 27, 2022
1 parent 29ff629 commit 5c98d4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions toot/tui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,13 @@ def _done(loop):
new_status = self.make_status(new_data)
timeline.update_status(new_status)

# Check if status is rebloggable
no_reblog_because_private = status.visibility == "private" and not status.is_mine
no_reblog_because_direct = status.visibility == "direct"
if no_reblog_because_private or no_reblog_because_direct:
self.footer.set_error_message("You may not reblog this {} status".format(status.visibility))
return

self.run_in_thread(
_unreblog if status.reblogged else _reblog,
done_callback=_done
Expand Down
1 change: 1 addition & 0 deletions toot/tui/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, data, is_mine, default_instance):
self.url = data.get("url")
self.mentions = data.get("mentions")
self.reblog = self._get_reblog()
self.visibility = data.get("visibility")

@property
def original(self):
Expand Down

0 comments on commit 5c98d4a

Please sign in to comment.