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

Hide polls and media for sensitive toots

This commit is contained in:
Daniel Schwarz 2022-12-27 04:53:58 -05:00 committed by GitHub
parent 5c98d4ac80
commit 8595e39f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,24 +277,24 @@ class StatusDetails(urwid.Pile):
for line in format_content(content): for line in format_content(content):
yield ("pack", urwid.Text(highlight_hashtags(line))) yield ("pack", urwid.Text(highlight_hashtags(line)))
media = status.data["media_attachments"] media = status.data["media_attachments"]
if media: if media:
for m in media: for m in media:
yield ("pack", urwid.AttrMap(urwid.Divider("-"), "gray")) yield ("pack", urwid.AttrMap(urwid.Divider("-"), "gray"))
yield ("pack", urwid.Text([("bold", "Media attachment"), " (", m["type"], ")"])) yield ("pack", urwid.Text([("bold", "Media attachment"), " (", m["type"], ")"]))
if m["description"]: if m["description"]:
yield ("pack", urwid.Text(m["description"])) yield ("pack", urwid.Text(m["description"]))
yield ("pack", urwid.Text(("link", m["url"]))) yield ("pack", urwid.Text(("link", m["url"])))
poll = status.data.get("poll") poll = status.data.get("poll")
if poll: if poll:
yield ("pack", urwid.Divider()) yield ("pack", urwid.Divider())
yield ("pack", self.build_linebox(self.poll_generator(poll))) yield ("pack", self.build_linebox(self.poll_generator(poll)))
card = status.data.get("card") card = status.data.get("card")
if card: if card:
yield ("pack", urwid.Divider()) yield ("pack", urwid.Divider())
yield ("pack", self.build_linebox(self.card_generator(card))) yield ("pack", self.build_linebox(self.card_generator(card)))
application = status.data.get("application") or {} application = status.data.get("application") or {}
application = application.get("name") application = application.get("name")