mirror of https://gitlab.com/bashrc2/epicyon
Show labels on posts
parent
bd39240b87
commit
3241c01e52
11
src/blog.py
11
src/blog.py
|
|
@ -10,6 +10,7 @@ __module_group__ = "ActivityPub"
|
|||
import os
|
||||
|
||||
from src.content import replace_emoji_from_tags
|
||||
from src.webapp_utils import labels_list_html
|
||||
from src.webapp_utils import html_header_with_external_style
|
||||
from src.webapp_utils import html_header_with_blog_markup
|
||||
from src.webapp_utils import html_footer
|
||||
|
|
@ -17,6 +18,7 @@ from src.webapp_utils import get_post_attachments_as_html
|
|||
from src.webapp_utils import edit_text_area
|
||||
from src.webapp_media import add_embedded_elements
|
||||
from src.timeFunctions import date_from_string_format
|
||||
from src.utils import get_labels_from_json
|
||||
from src.utils import replace_embedded_map_with_link
|
||||
from src.utils import replace_strings
|
||||
from src.utils import data_dir
|
||||
|
|
@ -395,6 +397,11 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
|||
languages_understood = get_actor_languages_list(actor_json)
|
||||
json_content = get_content_from_post(post_json_object, system_language,
|
||||
languages_understood, "content")
|
||||
|
||||
# any labels added to the post
|
||||
labels_list: list[str] = get_labels_from_json(post_json_object)
|
||||
labels_str: str = labels_list_html(labels_list)
|
||||
|
||||
minimize_all_images: bool = False
|
||||
attachment_str, _ = \
|
||||
get_post_attachments_as_html(base_dir, nickname, domain,
|
||||
|
|
@ -406,7 +413,7 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
|||
delete_str, mute_str,
|
||||
json_content,
|
||||
minimize_all_images,
|
||||
system_language)
|
||||
system_language, labels_str)
|
||||
if attachment_str:
|
||||
blog_str += '<br><center>' + attachment_str + '</center>'
|
||||
if json_content:
|
||||
|
|
@ -425,6 +432,8 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
|||
else:
|
||||
blog_str += '<br><article>' + content_str + '</article>\n'
|
||||
|
||||
blog_str += labels_str
|
||||
|
||||
citations_str: str = ''
|
||||
if post_json_object['object'].get('tag'):
|
||||
for tag_json in post_json_object['object']['tag']:
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ from src.textmode import text_mode_removals
|
|||
from src.quote import get_quote_toot_url
|
||||
from src.timeFunctions import date_from_string_format
|
||||
from src.timeFunctions import convert_published_to_local_timezone
|
||||
from src.utils import get_labels_from_json
|
||||
from src.utils import is_private_browser
|
||||
from src.utils import replace_embedded_map_with_link
|
||||
from src.utils import get_mutuals_of_person
|
||||
|
|
@ -108,6 +109,7 @@ from src.content import add_auto_cw
|
|||
from src.person import is_person_snoozed
|
||||
from src.person import get_person_avatar_url
|
||||
from src.textmode import text_mode_browser
|
||||
from src.webapp_utils import labels_list_html
|
||||
from src.webapp_utils import get_display_name_prefix
|
||||
from src.webapp_utils import get_show_map_button
|
||||
from src.webapp_utils import mitm_warning_html
|
||||
|
|
@ -2986,6 +2988,10 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
languages_understood, "content")
|
||||
content_str = dont_speak_hashtags(content_str)
|
||||
|
||||
# any labels added to the post
|
||||
labels_list = get_labels_from_json(post_json_object)
|
||||
labels_str = labels_list_html(labels_list)
|
||||
|
||||
attachment_str, gallery_str = \
|
||||
get_post_attachments_as_html(base_dir, nickname, domain,
|
||||
domain_full,
|
||||
|
|
@ -2996,7 +3002,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
bookmark_str, delete_str, mute_str,
|
||||
content_str,
|
||||
minimize_all_images,
|
||||
system_language)
|
||||
system_language,
|
||||
labels_str)
|
||||
|
||||
published_str: str = \
|
||||
_get_published_date_str(post_json_object, show_published_date_only,
|
||||
|
|
@ -3471,7 +3478,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
|
||||
post_html += \
|
||||
content_str + citations_str + map_str + \
|
||||
reaction_str + footer_str + '\n'
|
||||
reaction_str + labels_str + footer_str + '\n'
|
||||
post_html += ' </div>\n'
|
||||
else:
|
||||
post_html = gallery_str
|
||||
|
|
|
|||
|
|
@ -1301,7 +1301,8 @@ def get_post_attachments_as_html(base_dir: str,
|
|||
mute_str: str,
|
||||
content: str,
|
||||
minimize_all_images: bool,
|
||||
system_language: str) -> (str, str):
|
||||
system_language: str,
|
||||
labels_str: str) -> (str, str):
|
||||
"""Returns a string representing any attachments
|
||||
"""
|
||||
attachment_str: str = ''
|
||||
|
|
@ -1566,6 +1567,7 @@ def get_post_attachments_as_html(base_dir: str,
|
|||
else:
|
||||
gallery_str += \
|
||||
'<label class="transparent">---</label><br>'
|
||||
gallery_str += labels_str
|
||||
gallery_str += ' <div class="mediaicons">\n'
|
||||
# don't show the announce icon if there is no image
|
||||
# description
|
||||
|
|
@ -1697,6 +1699,7 @@ def get_post_attachments_as_html(base_dir: str,
|
|||
else:
|
||||
gallery_str += \
|
||||
'<label class="transparent">---</label><br>'
|
||||
gallery_str += labels_str
|
||||
gallery_str += ' <div class="mediaicons">\n'
|
||||
gallery_str += \
|
||||
' ' + reply_str + announce_str + like_str + \
|
||||
|
|
@ -1780,6 +1783,7 @@ def get_post_attachments_as_html(base_dir: str,
|
|||
else:
|
||||
gallery_str += \
|
||||
'<label class="transparent">---</label><br>'
|
||||
gallery_str += labels_str
|
||||
gallery_str += ' <div class="mediaicons">\n'
|
||||
gallery_str += \
|
||||
' ' + reply_str + announce_str + \
|
||||
|
|
|
|||
Loading…
Reference in New Issue