mirror of https://gitlab.com/bashrc2/epicyon
Set published and updated dates on edited posts
parent
33807ec7a9
commit
ff982c366c
21
daemon.py
21
daemon.py
|
@ -19235,6 +19235,16 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
edited_postid = edited_postid.split('?')[0]
|
edited_postid = edited_postid.split('?')[0]
|
||||||
print('DEBUG: edited_postid ' + edited_postid)
|
print('DEBUG: edited_postid ' + edited_postid)
|
||||||
|
|
||||||
|
# get the published date of an edited post
|
||||||
|
edited_published = None
|
||||||
|
if '?editpub=' in path:
|
||||||
|
edited_published = path.split('?editpub=')[1]
|
||||||
|
if '?' in edited_published:
|
||||||
|
edited_published = \
|
||||||
|
edited_published.split('?')[0]
|
||||||
|
print('DEBUG: edited_published ' +
|
||||||
|
edited_published)
|
||||||
|
|
||||||
length = int(headers['Content-Length'])
|
length = int(headers['Content-Length'])
|
||||||
if length > self.server.max_post_length:
|
if length > self.server.max_post_length:
|
||||||
print('POST size too large')
|
print('POST size too large')
|
||||||
|
@ -19862,12 +19872,23 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print('DEBUG: posting DM edited_postid ' +
|
print('DEBUG: posting DM edited_postid ' +
|
||||||
str(edited_postid))
|
str(edited_postid))
|
||||||
if edited_postid:
|
if edited_postid:
|
||||||
|
edited_updated = \
|
||||||
|
message_json['object']['published']
|
||||||
|
if edited_published:
|
||||||
|
message_json['published'] = \
|
||||||
|
edited_published
|
||||||
|
message_json['object']['published'] = \
|
||||||
|
edited_published
|
||||||
message_json['id'] = \
|
message_json['id'] = \
|
||||||
edited_postid + '/activity'
|
edited_postid + '/activity'
|
||||||
message_json['object']['id'] = \
|
message_json['object']['id'] = \
|
||||||
edited_postid
|
edited_postid
|
||||||
message_json['object']['url'] = \
|
message_json['object']['url'] = \
|
||||||
edited_postid
|
edited_postid
|
||||||
|
message_json['updated'] = \
|
||||||
|
edited_updated
|
||||||
|
message_json['object']['updated'] = \
|
||||||
|
edited_updated
|
||||||
message_json['type'] = 'Update'
|
message_json['type'] = 'Update'
|
||||||
print('DEBUG: sending edited dm post ' +
|
print('DEBUG: sending edited dm post ' +
|
||||||
str(message_json))
|
str(message_json))
|
||||||
|
|
|
@ -283,6 +283,7 @@ def html_new_post(edit_post_params: {},
|
||||||
"""
|
"""
|
||||||
# get the json if this is an edited post
|
# get the json if this is an edited post
|
||||||
edited_post_json = None
|
edited_post_json = None
|
||||||
|
edited_published = ''
|
||||||
if edit_post_params:
|
if edit_post_params:
|
||||||
if edit_post_params.get('post_url'):
|
if edit_post_params.get('post_url'):
|
||||||
edited_post_filename = \
|
edited_post_filename = \
|
||||||
|
@ -300,6 +301,8 @@ def html_new_post(edit_post_params: {},
|
||||||
in_reply_to = edit_post_params['replyTo']
|
in_reply_to = edit_post_params['replyTo']
|
||||||
if edit_post_params['scope'] == 'dm':
|
if edit_post_params['scope'] == 'dm':
|
||||||
mentions = edited_post_json['object']['to']
|
mentions = edited_post_json['object']['to']
|
||||||
|
edited_published = \
|
||||||
|
edited_post_json['object']['published']
|
||||||
|
|
||||||
# default subject line or content warning
|
# default subject line or content warning
|
||||||
default_subject = ''
|
default_subject = ''
|
||||||
|
@ -961,7 +964,8 @@ def html_new_post(edit_post_params: {},
|
||||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||||
'accept-charset="UTF-8" action="' + \
|
'accept-charset="UTF-8" action="' + \
|
||||||
path + '?' + endpoint + '?page=' + str(page_number) + \
|
path + '?' + endpoint + '?page=' + str(page_number) + \
|
||||||
'?editid=' + edit_post_params['post_url'] + '">\n'
|
'?editid=' + edit_post_params['post_url'] + \
|
||||||
|
'?editpub=' + edited_published + '">\n'
|
||||||
else:
|
else:
|
||||||
new_post_form += \
|
new_post_form += \
|
||||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||||
|
|
Loading…
Reference in New Issue