diff --git a/utils.py b/utils.py index 8eb0eb085..4d78cfe69 100644 --- a/utils.py +++ b/utils.py @@ -2046,6 +2046,28 @@ def is_dm(post_json_object: {}) -> bool: 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: """Is the given post a DM from a different domain? """ diff --git a/webapp_post.py b/webapp_post.py index f29f80ab1..720588964 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -40,6 +40,7 @@ from utils import has_object_dict from utils import update_announce_collection from utils import is_pgp_encrypted from utils import is_dm +from utils import is_reminder from utils import is_chat_message from utils import reject_post_id from utils import is_recent_post @@ -612,6 +613,21 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str, '' + edit_post_str + \
                 ' |\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 += \ + ' ' + \ + '' + \ + '' + edit_post_str + \
+                ' |\n' elif is_dm(post_json_object): # Edit a DM edit_post_str = 'Edit post'