Handle editing replies

main
Bob Mottram 2022-11-15 23:26:58 +00:00
parent c67ce06ea6
commit 07444e0658
4 changed files with 16 additions and 5 deletions

View File

@ -18249,6 +18249,11 @@ class PubServer(BaseHTTPRequestHandler):
message_id = self.path.split(';postid=')[1]
if ';' in message_id:
message_id = message_id.split(';')[0]
if ';replyTo=' in self.path:
reply_to = self.path.split(';replyTo=')[1]
if ';' in reply_to:
reply_to = message_id.split(';')[0]
edit_post_params['replyTo'] = reply_to
actor = self.path.split(';actor=')[1]
if ';' in actor:
actor = actor.split(';')[0]

View File

@ -2240,7 +2240,7 @@ def _get_reserved_words() -> str:
'minimal', 'search', 'eventdelete',
'searchemoji', 'catalog', 'conversationId',
'mention', 'http', 'https', 'ipfs', 'ipns',
'ontologies', 'data')
'ontologies', 'data', 'postedit')
def get_nickname_validation_pattern() -> str:

View File

@ -278,6 +278,8 @@ def html_new_post(edit_post_params: {},
return ''
if edited_post_json['object'].get('conversation'):
conversation_id = edited_post_json['object']['conversation']
if edit_post_params.get('replyTo'):
in_reply_to = edit_post_params['replyTo']
# default subject line or content warning
default_subject = ''

View File

@ -534,6 +534,10 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
if '/statuses/' not in post_id:
return edit_str
reply_to = ''
if post_json_object['object'].get('inReplyTo'):
reply_to = ';replyTo=' + post_json_object['object']['inReplyTo']
if is_blog_post(post_json_object):
edit_blog_post_str = 'Edit blog post'
if translate.get(edit_blog_post_str):
@ -584,7 +588,7 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
'<a class="imageAnchor" href="/users/' + \
nickname + '/postedit?scope=public;postid=' + \
post_id.split('/statuses/')[1] + \
';actor=' + actor_nickname + \
';actor=' + actor_nickname + reply_to + \
'" title="' + edit_post_str + '" tabindex="10">' + \
'<img loading="lazy" decoding="async" title="' + \
edit_post_str + '" alt="' + edit_post_str + \
@ -599,7 +603,7 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
'<a class="imageAnchor" href="/users/' + \
nickname + '/postedit?scope=dm;postid=' + \
post_id.split('/statuses/')[1] + \
';actor=' + actor_nickname + \
';actor=' + actor_nickname + reply_to + \
'" title="' + edit_post_str + '" tabindex="10">' + \
'<img loading="lazy" decoding="async" title="' + \
edit_post_str + '" alt="' + edit_post_str + \
@ -614,7 +618,7 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
'<a class="imageAnchor" href="/users/' + \
nickname + '/postedit?scope=unlisted;postid=' + \
post_id.split('/statuses/')[1] + \
';actor=' + actor_nickname + \
';actor=' + actor_nickname + reply_to + \
'" title="' + edit_post_str + '" tabindex="10">' + \
'<img loading="lazy" decoding="async" title="' + \
edit_post_str + '" alt="' + edit_post_str + \
@ -629,7 +633,7 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
'<a class="imageAnchor" href="/users/' + \
nickname + '/postedit?scope=followers;postid=' + \
post_id.split('/statuses/')[1] + \
';actor=' + actor_nickname + \
';actor=' + actor_nickname + reply_to + \
'" title="' + edit_post_str + '" tabindex="10">' + \
'<img loading="lazy" decoding="async" title="' + \
edit_post_str + '" alt="' + edit_post_str + \