mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Added visibility as a variable template for toots
This commit is contained in:
parent
bfbb280c27
commit
2c9048618f
@ -44,7 +44,7 @@ braille_reporting = boolean(default=True)
|
||||
speech_reporting = boolean(default=True)
|
||||
|
||||
[templates]
|
||||
toot = string(default="$display_name, $safe_text $image_descriptions $date. $source")
|
||||
toot = string(default="$display_name, $safe_text $image_descriptions $date. $visibility. $source")
|
||||
person = string(default="$display_name (@$screen_name). $followers followers, $following following, $toots toots. Joined $created_at.")
|
||||
conversation = string(default="Conversation with $users. Last message: $last_toot")
|
||||
|
||||
|
@ -9,7 +9,7 @@ from . import utils, compose
|
||||
# This will be used for the edit template dialog.
|
||||
# Available variables for toot objects.
|
||||
# safe_text will be the content warning in case a toot contains one, text will always be the full text, no matter if has a content warning or not.
|
||||
toot_variables = ["date", "display_name", "screen_name", "source", "lang", "safe_text", "text", "image_descriptions"]
|
||||
toot_variables = ["date", "display_name", "screen_name", "source", "lang", "safe_text", "text", "image_descriptions", "visibility"]
|
||||
person_variables = ["display_name", "screen_name", "description", "followers", "following", "favorites", "toots", "created_at"]
|
||||
conversation_variables = ["users", "last_toot"]
|
||||
|
||||
@ -59,6 +59,7 @@ def render_toot(toot, template, relative_times=False, offset_hours=0):
|
||||
$safe_text: Safe text to display. If a content warning is applied in toots, display those instead of the whole toot.
|
||||
$text: Toot text. This always displays the full text, even if there is a content warning present.
|
||||
$image_descriptions: Information regarding image descriptions added by twitter users.
|
||||
$visibility: toot's visibility: public, not listed, followers only or direct.
|
||||
"""
|
||||
global toot_variables
|
||||
available_data = dict()
|
||||
@ -79,7 +80,9 @@ def render_toot(toot, template, relative_times=False, offset_hours=0):
|
||||
else:
|
||||
text = process_text(toot, safe=False)
|
||||
safe_text = process_text(toot)
|
||||
available_data.update(lang=toot.language, text=text, safe_text=safe_text)
|
||||
visibility_settings = dict(public=_("Public"), unlisted=_("Not listed"), private=_("Followers only"), direct=_("Direct"))
|
||||
visibility = visibility_settings.get(toot.visibility)
|
||||
available_data.update(lang=toot.language, text=text, safe_text=safe_text, visibility=visibility)
|
||||
# process image descriptions
|
||||
image_descriptions = ""
|
||||
if toot.reblog != None:
|
||||
|
Loading…
Reference in New Issue
Block a user