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.
pull/122/head
Denis Laxalde 2019-09-06 16:01:04 +02:00 zatwierdzone przez Ivan Habunek
rodzic 3a56243878
commit 9d0d1b2dd7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: CDBD63C43A30BB95
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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)