mirror of https://gitlab.com/bashrc2/epicyon
Move function
parent
f27a9110c0
commit
ef1a8171bf
|
@ -697,3 +697,11 @@ def outbox_undo_bookmark(recent_posts_cache: {},
|
|||
actor_url, domain, debug)
|
||||
if debug:
|
||||
print('DEBUG: post unbookmarked via c2s - ' + post_filename)
|
||||
|
||||
|
||||
def bookmark_from_id(post_id: str) -> str:
|
||||
""" Converts a post id into a bookmark
|
||||
"""
|
||||
timeline_post_bookmark = remove_id_ending(post_id)
|
||||
timeline_post_bookmark = timeline_post_bookmark.replace('://', '-')
|
||||
return timeline_post_bookmark.replace('/', '-')
|
||||
|
|
|
@ -14,6 +14,7 @@ from dateutil.parser import parse
|
|||
from auth import create_password
|
||||
from git import is_git_patch
|
||||
from cache import get_person_from_cache
|
||||
from bookmarks import bookmark_from_id
|
||||
from bookmarks import bookmarked_by_person
|
||||
from announce import announced_by_person
|
||||
from announce import no_of_announces
|
||||
|
@ -132,14 +133,6 @@ from session import get_json
|
|||
MAX_DISPLAY_NAME_LENGTH = 42
|
||||
|
||||
|
||||
def _bookmark_from_id(post_id: str) -> str:
|
||||
""" Converts a post id into a bookmark
|
||||
"""
|
||||
timeline_post_bookmark = remove_id_ending(post_id)
|
||||
timeline_post_bookmark = timeline_post_bookmark.replace('://', '-')
|
||||
return timeline_post_bookmark.replace('/', '-')
|
||||
|
||||
|
||||
def _enforce_max_display_name_length(display_name: str) -> str:
|
||||
"""Ensures that the display name does not get too long
|
||||
"""
|
||||
|
@ -1351,7 +1344,7 @@ def _announce_unattributed_html(translate: {},
|
|||
if translate.get(announces_str):
|
||||
announces_str = translate[announces_str]
|
||||
post_id = remove_id_ending(post_json_object['object']['id'])
|
||||
post_bookmark = '#' + _bookmark_from_id(post_id)
|
||||
post_bookmark = '#' + bookmark_from_id(post_id)
|
||||
post_link = '/users/' + nickname + '?convthread=' + \
|
||||
post_id.replace('--', '/') + post_bookmark
|
||||
return ' <img loading="lazy" decoding="async" title="' + \
|
||||
|
@ -1374,7 +1367,7 @@ def _announce_with_display_name_html(translate: {},
|
|||
if translate.get(announces_str):
|
||||
announces_str = translate[announces_str]
|
||||
post_id = remove_id_ending(post_json_object['object']['id'])
|
||||
post_bookmark = '#' + _bookmark_from_id(post_id)
|
||||
post_bookmark = '#' + bookmark_from_id(post_id)
|
||||
post_link = '/users/' + nickname + '?convthread=' + \
|
||||
post_id.replace('--', '/') + post_bookmark
|
||||
return ' <img loading="lazy" decoding="async" title="' + \
|
||||
|
@ -1543,7 +1536,7 @@ def _reply_to_unknown_html(translate: {},
|
|||
"""
|
||||
replying_to_str = _replying_to_with_scope(post_json_object, translate)
|
||||
post_id = get_reply_to(post_json_object['object'])
|
||||
post_bookmark = '#' + _bookmark_from_id(post_id)
|
||||
post_bookmark = '#' + bookmark_from_id(post_id)
|
||||
post_link = '/users/' + nickname + '?convthread=' + \
|
||||
post_id.replace('--', '/') + post_bookmark
|
||||
return ' <img loading="lazy" decoding="async" title="' + \
|
||||
|
@ -1574,7 +1567,7 @@ def _reply_with_unknown_path_html(translate: {},
|
|||
"""
|
||||
replying_to_str = _replying_to_with_scope(post_json_object, translate)
|
||||
post_id = get_reply_to(post_json_object['object'])
|
||||
post_bookmark = '#' + _bookmark_from_id(post_id)
|
||||
post_bookmark = '#' + bookmark_from_id(post_id)
|
||||
post_link = '/users/' + nickname + '?convthread=' + \
|
||||
post_id.replace('--', '/') + post_bookmark
|
||||
return ' <img loading="lazy" decoding="async" title="' + \
|
||||
|
@ -1597,7 +1590,7 @@ def _get_reply_html(translate: {},
|
|||
if not in_reply_to:
|
||||
return ''
|
||||
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=' + \
|
||||
in_reply_to.replace('--', '/') + post_bookmark
|
||||
return ' ' + \
|
||||
|
@ -1872,7 +1865,7 @@ def _get_footer_with_icons(show_icons: bool,
|
|||
footer_str += _get_copyright_footer(content_license_url,
|
||||
translate)
|
||||
# show the date
|
||||
post_bookmark = '#' + _bookmark_from_id(published_link)
|
||||
post_bookmark = '#' + bookmark_from_id(published_link)
|
||||
date_link = '/users/' + nickname + '?convthread=' + \
|
||||
published_link.replace('--', '/') + post_bookmark
|
||||
footer_str += '<a href="' + date_link + '" class="' + \
|
||||
|
@ -2279,7 +2272,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
avatar_image_in_post = \
|
||||
' <div class="timeline-avatar">' + avatar_link + '</div>\n'
|
||||
|
||||
timeline_post_bookmark = _bookmark_from_id(post_json_object['id'])
|
||||
timeline_post_bookmark = bookmark_from_id(post_json_object['id'])
|
||||
|
||||
# If this is the inbox timeline then don't show the repeat icon on any DMs
|
||||
show_repeat_icon = show_repeats
|
||||
|
@ -2725,7 +2718,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
if content_license_url and not is_reminder(post_json_object):
|
||||
footer_str += _get_copyright_footer(content_license_url,
|
||||
translate)
|
||||
post_bookmark = '#' + _bookmark_from_id(published_link)
|
||||
post_bookmark = '#' + bookmark_from_id(published_link)
|
||||
conv_link = '/users/' + nickname + '?convthread=' + \
|
||||
published_link.replace('--', '/') + post_bookmark
|
||||
footer_str += '<a href="' + conv_link + \
|
||||
|
|
Loading…
Reference in New Issue