Skip to content

Commit

Permalink
Make "view" action work for reblogged statuses
Browse files Browse the repository at this point in the history
When the status is a reblog, the URL of the original toot should be used
as the one of reblog is null.

We add a "url" attribute to Status class storing computed URL.
  • Loading branch information
dlax authored and ihabunek committed Sep 6, 2019
1 parent 3a56243 commit 9d0d1b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions toot/tui/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def __init__(self, data, is_mine, default_instance):
self.reblogged = data.get("reblogged", False)
self.in_reply_to = data.get("in_reply_to_id")

reblog = data.get("reblog")
self.url = reblog.get("url") if reblog else data.get("url")

def get_author(self):
# Show the author, not the persopn who reblogged
data = self.data["reblog"] or self.data
Expand Down
4 changes: 2 additions & 2 deletions toot/tui/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def keypress(self, size, key):
return

if key in ("v", "V"):
if status.data["url"]:
webbrowser.open(status.data["url"])
if status.url:
webbrowser.open(status.url)
return

return super().keypress(size, key)
Expand Down

0 comments on commit 9d0d1b2

Please sign in to comment.