mirror of https://gitlab.com/bashrc2/epicyon
Edit reminder
parent
d3fe3110e9
commit
640ffec1c3
22
utils.py
22
utils.py
|
@ -2046,6 +2046,28 @@ def is_dm(post_json_object: {}) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def is_reminder(post_json_object: {}) -> bool:
|
||||||
|
"""Returns true if the given post is a reminder
|
||||||
|
"""
|
||||||
|
if not is_dm(post_json_object):
|
||||||
|
return False
|
||||||
|
if not post_json_object['object'].get('to'):
|
||||||
|
return False
|
||||||
|
if not post_json_object['object'].get('attributedTo'):
|
||||||
|
return False
|
||||||
|
if not post_json_object['object'].get('tag'):
|
||||||
|
return False
|
||||||
|
if len(post_json_object['object']['to']) != 1:
|
||||||
|
return False
|
||||||
|
if post_json_object['object']['to'][0] != \
|
||||||
|
post_json_object['object']['attributedTo']:
|
||||||
|
return False
|
||||||
|
for tag in post_json_object['object']['tag']:
|
||||||
|
if tag['type'] == 'Event':
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _is_remote_dm(domain_full: str, post_json_object: {}) -> bool:
|
def _is_remote_dm(domain_full: str, post_json_object: {}) -> bool:
|
||||||
"""Is the given post a DM from a different domain?
|
"""Is the given post a DM from a different domain?
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -40,6 +40,7 @@ from utils import has_object_dict
|
||||||
from utils import update_announce_collection
|
from utils import update_announce_collection
|
||||||
from utils import is_pgp_encrypted
|
from utils import is_pgp_encrypted
|
||||||
from utils import is_dm
|
from utils import is_dm
|
||||||
|
from utils import is_reminder
|
||||||
from utils import is_chat_message
|
from utils import is_chat_message
|
||||||
from utils import reject_post_id
|
from utils import reject_post_id
|
||||||
from utils import is_recent_post
|
from utils import is_recent_post
|
||||||
|
@ -612,6 +613,21 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
|
||||||
'<img loading="lazy" decoding="async" title="' + \
|
'<img loading="lazy" decoding="async" title="' + \
|
||||||
edit_post_str + '" alt="' + edit_post_str + \
|
edit_post_str + '" alt="' + edit_post_str + \
|
||||||
' |" src="/icons/edit.png"/></a>\n'
|
' |" src="/icons/edit.png"/></a>\n'
|
||||||
|
elif is_reminder(post_json_object):
|
||||||
|
# Edit a reminder
|
||||||
|
edit_post_str = 'Edit reminder'
|
||||||
|
if translate.get(edit_post_str):
|
||||||
|
edit_post_str = translate[edit_post_str]
|
||||||
|
edit_str += \
|
||||||
|
' ' + \
|
||||||
|
'<a class="imageAnchor" href="/users/' + \
|
||||||
|
nickname + '?postedit=' + \
|
||||||
|
post_id.split('/statuses/')[1] + ';scope=reminder' + \
|
||||||
|
';actor=' + actor_nickname + reply_to + \
|
||||||
|
'" title="' + edit_post_str + '" tabindex="10">' + \
|
||||||
|
'<img loading="lazy" decoding="async" title="' + \
|
||||||
|
edit_post_str + '" alt="' + edit_post_str + \
|
||||||
|
' |" src="/icons/edit.png"/></a>\n'
|
||||||
elif is_dm(post_json_object):
|
elif is_dm(post_json_object):
|
||||||
# Edit a DM
|
# Edit a DM
|
||||||
edit_post_str = 'Edit post'
|
edit_post_str = 'Edit post'
|
||||||
|
|
Loading…
Reference in New Issue