mirror of
https://github.com/ihabunek/toot
synced 2025-02-02 12:26:51 +01: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', 'white', 'black'),
|
||||||
('button_focused', 'light gray', 'dark magenta'),
|
('button_focused', 'light gray', 'dark magenta'),
|
||||||
('editbox', 'white', 'black'),
|
('editbox', 'white', 'black'),
|
||||||
('editbox_focused', '', 'dark magenta'),
|
('editbox_focused', 'white', 'dark magenta'),
|
||||||
('footer_message', 'dark green', ''),
|
('footer_message', 'dark green', ''),
|
||||||
('footer_message_error', 'light red', ''),
|
('footer_message_error', 'light red', ''),
|
||||||
('footer_status', 'white', 'dark blue'),
|
('footer_status', 'white', 'dark blue'),
|
||||||
@ -13,6 +13,7 @@ PALETTE = [
|
|||||||
('header_bold', 'white,bold', 'dark blue'),
|
('header_bold', 'white,bold', 'dark blue'),
|
||||||
('intro_bigtext', 'yellow', ''),
|
('intro_bigtext', 'yellow', ''),
|
||||||
('intro_smalltext', 'light blue', ''),
|
('intro_smalltext', 'light blue', ''),
|
||||||
|
('content_warning', 'white', 'dark magenta'),
|
||||||
|
|
||||||
# Functional
|
# Functional
|
||||||
('hashtag', 'light cyan,bold', ''),
|
('hashtag', 'light cyan,bold', ''),
|
||||||
|
@ -24,6 +24,9 @@ class Status:
|
|||||||
self.data = data
|
self.data = data
|
||||||
self.instance = instance
|
self.instance = instance
|
||||||
|
|
||||||
|
# This can be toggled by the user
|
||||||
|
self.show_sensitive = False
|
||||||
|
|
||||||
# TODO: make Status immutable?
|
# TODO: make Status immutable?
|
||||||
|
|
||||||
self.id = self.data["id"]
|
self.id = self.data["id"]
|
||||||
|
@ -122,6 +122,11 @@ class Timeline(urwid.Columns):
|
|||||||
self._emit("reply", status)
|
self._emit("reply", status)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if key in ("s", "S"):
|
||||||
|
status.show_sensitive = True
|
||||||
|
self.refresh_status_details()
|
||||||
|
return
|
||||||
|
|
||||||
if key in ("t", "T"):
|
if key in ("t", "T"):
|
||||||
self._emit("thread", status)
|
self._emit("thread", status)
|
||||||
return
|
return
|
||||||
@ -194,6 +199,14 @@ class StatusDetails(urwid.Pile):
|
|||||||
yield ("pack", urwid.Text(("yellow", status.author.account)))
|
yield ("pack", urwid.Text(("yellow", status.author.account)))
|
||||||
yield ("pack", urwid.Divider())
|
yield ("pack", urwid.Divider())
|
||||||
|
|
||||||
|
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"]):
|
for line in format_content(status.data["content"]):
|
||||||
yield ("pack", urwid.Text(highlight_hashtags(line)))
|
yield ("pack", urwid.Text(highlight_hashtags(line)))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user