diff --git a/INSTALL.md b/INSTALL.md index 1c896b18..f1095a55 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -79,7 +79,7 @@ sudo apt install tesseract-ocr * Clone PyFedi -```basg +```bash git clone https://codeberg.org/rimu/pyfedi.git ``` diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index d84c5794..a9cf8d65 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -672,30 +672,16 @@ def process_inbox_request(request_json, activitypublog_id, ip_address): ocp.cross_posts.remove(post.id) delete_post_or_comment(user_ap_id, community_ap_id, to_be_deleted_ap_id) activity_log.result = 'success' - elif request_json['object']['type'] == 'Page': # Editing a post - post = Post.query.filter_by(ap_id=request_json['object']['id']).first() - if post: - try: - update_post_from_activity(post, request_json) - except KeyError: - activity_log.result = 'exception' - db.session.commit() - return - activity_log.result = 'success' - else: - activity_log.exception_message = 'Post not found' - elif request_json['object']['type'] == 'Note': # Editing a reply - reply = PostReply.query.filter_by(ap_id=request_json['object']['id']).first() - if reply: - try: - update_post_reply_from_activity(reply, request_json) - except KeyError: - activity_log.result = 'exception' - db.session.commit() - return - activity_log.result = 'success' - else: - activity_log.exception_message = 'PostReply not found' + elif request_json['object']['type'] == 'Page': # Sent for Mastodon's benefit + activity_log.result = 'ignored' + activity_log.exception_message = 'Intended for Mastodon' + db.session.add(activity_log) + db.session.commit() + elif request_json['object']['type'] == 'Note': # Never sent? + activity_log.result = 'ignored' + activity_log.exception_message = 'Intended for Mastodon' + db.session.add(activity_log) + db.session.commit() elif request_json['object']['type'] == 'Update': # Editing a post or comment if request_json['object']['object']['type'] == 'Page': post = Post.query.filter_by(ap_id=request_json['object']['object']['id']).first() diff --git a/app/templates/post/post_reply_edit.html b/app/templates/post/post_reply_edit.html index 5c3c2339..cd041e57 100644 --- a/app/templates/post/post_reply_edit.html +++ b/app/templates/post/post_reply_edit.html @@ -41,9 +41,9 @@
{% if current_user.is_authenticated and community_membership(current_user, post.community) %} - {{ _('Unsubscribe') }} + {{ _('Leave') }} {% else %} - {{ _('Subscribe') }} + {{ _('Join') }} {% endif %}
diff --git a/app/utils.py b/app/utils.py index 59fc23cd..7daf92ef 100644 --- a/app/utils.py +++ b/app/utils.py @@ -231,7 +231,7 @@ def markdown_to_html(markdown_text) -> str: if markdown_text: raw_html = markdown2.markdown(markdown_text, safe_mode=True, extras={'middle-word-em': False, 'tables': True, 'fenced-code-blocks': True, 'strike': True}) # replace lemmy spoiler tokens with appropriate html tags instead. (until possibly added as extra to markdown2) - re_spoiler = re.compile(r':{3} spoiler\s+?(\S.+?)(?:\n|

)(.+?)(?:\n|

):{3}', re.S) + re_spoiler = re.compile(r':{3}\s*?spoiler\s+?(\S.+?)(?:\n|

)(.+?)(?:\n|

):{3}', re.S) raw_html = re_spoiler.sub(r'

\1

\2

', raw_html) return allowlist_html(raw_html) else: