1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-23 07:27:12 +01:00

Make "view" action work for reblogged statuses

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.
This commit is contained in:
Denis Laxalde 2019-09-06 16:01:04 +02:00 committed by Ivan Habunek
parent 3a56243878
commit 9d0d1b2dd7
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
2 changed files with 5 additions and 2 deletions

View File

@ -31,6 +31,9 @@ class Status:
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

View File

@ -149,8 +149,8 @@ class Timeline(urwid.Columns):
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)