From 9fb52fb0a193e785e8112d380111c2603640fa70 Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Fri, 13 Sep 2019 12:43:37 +0200 Subject: [PATCH] Try to use media's text_url if present This field is sometimes provides and gives a shortened URL which is easier to click on in a terminal. --- toot/tui/timeline.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toot/tui/timeline.py b/toot/tui/timeline.py index 12c2308..5595150 100644 --- a/toot/tui/timeline.py +++ b/toot/tui/timeline.py @@ -238,7 +238,8 @@ class StatusDetails(urwid.Pile): yield ("pack", urwid.Text([("bold", "Media attachment"), " (", m["type"], ")"])) if m["description"]: yield ("pack", urwid.Text(m["description"])) - yield ("pack", urwid.Text(("link", m["url"]))) + url = m.get("text_url") or m["url"] + yield ("pack", urwid.Text(("link", url))) poll = status.data.get("poll") if poll: