mirror of https://gitlab.com/bashrc2/epicyon
Apply mutuals icon to replies
parent
3f21cdb597
commit
e196332520
|
|
@ -31,6 +31,14 @@ def text_mode_removals(text: str, translate: {}) -> str:
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
def text_mode_replacements(text: str, translate: {}) -> str:
|
||||||
|
"""Replaces some elements of a post when displaying in a text mode browser
|
||||||
|
"""
|
||||||
|
text = text.replace('">⇆ ', '">' + translate['Mutual'] + ' ')
|
||||||
|
text = text.replace(' ⇆ ', ' ' + translate['Mutual'] + ' ')
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
def get_text_mode_banner(base_dir: str) -> str:
|
def get_text_mode_banner(base_dir: str) -> str:
|
||||||
"""Returns the banner used for shell browsers, like Lynx
|
"""Returns the banner used for shell browsers, like Lynx
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1711,9 +1711,19 @@ def _get_reply_html(translate: {},
|
||||||
nickname: str,
|
nickname: str,
|
||||||
post_json_object: {},
|
post_json_object: {},
|
||||||
reply_handle: str,
|
reply_handle: str,
|
||||||
software_name: str) -> str:
|
software_name: str,
|
||||||
|
mutuals_list: [],
|
||||||
|
is_text_mode: bool) -> str:
|
||||||
"""Returns html title for a reply
|
"""Returns html title for a reply
|
||||||
"""
|
"""
|
||||||
|
# add mutual icon to the display name
|
||||||
|
mutual_prefix = ''
|
||||||
|
if reply_handle in mutuals_list:
|
||||||
|
if not is_text_mode:
|
||||||
|
mutual_prefix = '⇆ '
|
||||||
|
else:
|
||||||
|
mutual_prefix = translate['Mutual'] + ' '
|
||||||
|
|
||||||
replying_to_str = _replying_to_with_scope(post_json_object, translate)
|
replying_to_str = _replying_to_with_scope(post_json_object, translate)
|
||||||
post_bookmark = '#' + bookmark_from_id(in_reply_to)
|
post_bookmark = '#' + bookmark_from_id(in_reply_to)
|
||||||
post_link = '/users/' + nickname + '?convthread=' + \
|
post_link = '/users/' + nickname + '?convthread=' + \
|
||||||
|
|
@ -1728,7 +1738,7 @@ def _get_reply_html(translate: {},
|
||||||
' <a href="' + post_link + \
|
' <a href="' + post_link + \
|
||||||
'" class="announceOrReply" tabindex="10" title="' + \
|
'" class="announceOrReply" tabindex="10" title="' + \
|
||||||
reply_handle + '">' + '<span itemprop="audience">' + \
|
reply_handle + '">' + '<span itemprop="audience">' + \
|
||||||
reply_display_name + '</span></a>\n'
|
mutual_prefix + reply_display_name + '</span></a>\n'
|
||||||
|
|
||||||
title_str += _get_instance_software_html(title_str, software_name)
|
title_str += _get_instance_software_html(title_str, software_name)
|
||||||
return title_str
|
return title_str
|
||||||
|
|
@ -1752,7 +1762,9 @@ def _get_post_title_reply_html(base_dir: str,
|
||||||
signing_priv_key_pem: str,
|
signing_priv_key_pem: str,
|
||||||
session, debug: bool,
|
session, debug: bool,
|
||||||
mitm_servers: [],
|
mitm_servers: [],
|
||||||
software_name: str) -> (str, str, str, str):
|
software_name: str,
|
||||||
|
mutuals_list: [],
|
||||||
|
is_text_mode: bool) -> (str, str, str, str):
|
||||||
"""Returns the reply title of a post containing names of participants
|
"""Returns the reply title of a post containing names of participants
|
||||||
x replies to y
|
x replies to y
|
||||||
"""
|
"""
|
||||||
|
|
@ -1882,7 +1894,7 @@ def _get_post_title_reply_html(base_dir: str,
|
||||||
title_str += \
|
title_str += \
|
||||||
_get_reply_html(translate, in_reply_to, reply_display_name,
|
_get_reply_html(translate, in_reply_to, reply_display_name,
|
||||||
nickname, post_json_object, reply_handle,
|
nickname, post_json_object, reply_handle,
|
||||||
software_name)
|
software_name, mutuals_list, is_text_mode)
|
||||||
|
|
||||||
if mitm or reply_domain in mitm_servers:
|
if mitm or reply_domain in mitm_servers:
|
||||||
title_str += mitm_warning_html(translate)
|
title_str += mitm_warning_html(translate)
|
||||||
|
|
@ -1989,7 +2001,9 @@ def _get_post_title_html(base_dir: str,
|
||||||
signing_priv_key_pem,
|
signing_priv_key_pem,
|
||||||
session, debug,
|
session, debug,
|
||||||
mitm_servers,
|
mitm_servers,
|
||||||
software_name)
|
software_name,
|
||||||
|
mutuals_list,
|
||||||
|
is_text_mode)
|
||||||
|
|
||||||
|
|
||||||
def _get_footer_with_icons(show_icons: bool,
|
def _get_footer_with_icons(show_icons: bool,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ from utils import local_actor_url
|
||||||
from utils import remove_eol
|
from utils import remove_eol
|
||||||
from utils import get_actor_from_post
|
from utils import get_actor_from_post
|
||||||
from textmode import text_mode_removals
|
from textmode import text_mode_removals
|
||||||
|
from textmode import text_mode_replacements
|
||||||
from follow import follower_approval_active
|
from follow import follower_approval_active
|
||||||
from person import is_person_snoozed
|
from person import is_person_snoozed
|
||||||
from markdown import markdown_to_html
|
from markdown import markdown_to_html
|
||||||
|
|
@ -1169,6 +1170,7 @@ def html_timeline(default_timeline: str,
|
||||||
# Also replace MITM text with an eye icon
|
# Also replace MITM text with an eye icon
|
||||||
if is_text_browser:
|
if is_text_browser:
|
||||||
tl_str = text_mode_removals(tl_str, translate)
|
tl_str = text_mode_removals(tl_str, translate)
|
||||||
|
tl_str = text_mode_replacements(tl_str, translate)
|
||||||
|
|
||||||
tl_str += \
|
tl_str += \
|
||||||
_html_timeline_end(base_dir, nickname, domain_full,
|
_html_timeline_end(base_dir, nickname, domain_full,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue