mirror of
https://github.com/ihabunek/toot.git
synced 2024-11-03 04:17:21 -05:00
Show content warning in status details
This commit is contained in:
parent
85ceb8b11f
commit
1dce948166
@ -4,7 +4,7 @@ PALETTE = [
|
||||
('button', 'white', 'black'),
|
||||
('button_focused', 'light gray', 'dark magenta'),
|
||||
('editbox', 'white', 'black'),
|
||||
('editbox_focused', '', 'dark magenta'),
|
||||
('editbox_focused', 'white', 'dark magenta'),
|
||||
('footer_message', 'dark green', ''),
|
||||
('footer_message_error', 'light red', ''),
|
||||
('footer_status', 'white', 'dark blue'),
|
||||
@ -13,6 +13,7 @@ PALETTE = [
|
||||
('header_bold', 'white,bold', 'dark blue'),
|
||||
('intro_bigtext', 'yellow', ''),
|
||||
('intro_smalltext', 'light blue', ''),
|
||||
('content_warning', 'white', 'dark magenta'),
|
||||
|
||||
# Functional
|
||||
('hashtag', 'light cyan,bold', ''),
|
||||
|
@ -24,6 +24,9 @@ class Status:
|
||||
self.data = data
|
||||
self.instance = instance
|
||||
|
||||
# This can be toggled by the user
|
||||
self.show_sensitive = False
|
||||
|
||||
# TODO: make Status immutable?
|
||||
|
||||
self.id = self.data["id"]
|
||||
|
@ -122,6 +122,11 @@ class Timeline(urwid.Columns):
|
||||
self._emit("reply", status)
|
||||
return
|
||||
|
||||
if key in ("s", "S"):
|
||||
status.show_sensitive = True
|
||||
self.refresh_status_details()
|
||||
return
|
||||
|
||||
if key in ("t", "T"):
|
||||
self._emit("thread", status)
|
||||
return
|
||||
@ -194,8 +199,16 @@ class StatusDetails(urwid.Pile):
|
||||
yield ("pack", urwid.Text(("yellow", status.author.account)))
|
||||
yield ("pack", urwid.Divider())
|
||||
|
||||
for line in format_content(status.data["content"]):
|
||||
yield ("pack", urwid.Text(highlight_hashtags(line)))
|
||||
if status.data["spoiler_text"]:
|
||||
yield ("pack", urwid.Text(status.data["spoiler_text"]))
|
||||
yield ("pack", urwid.Divider())
|
||||
|
||||
# Show content warning
|
||||
if status.data["spoiler_text"] and not status.show_sensitive:
|
||||
yield ("pack", urwid.Text(("content_warning", "Marked as sensitive. Press S to view.")))
|
||||
else:
|
||||
for line in format_content(status.data["content"]):
|
||||
yield ("pack", urwid.Text(highlight_hashtags(line)))
|
||||
|
||||
media = status.data["media_attachments"]
|
||||
if media:
|
||||
|
Loading…
Reference in New Issue
Block a user