diff --git a/delete.py b/delete.py index bb106b7ed..5f574d4f6 100644 --- a/delete.py +++ b/delete.py @@ -18,7 +18,7 @@ from utils import get_nickname_from_actor from utils import get_domain_from_actor from utils import locate_post from utils import deletePost -from utils import removeModerationPostFromIndex +from utils import remove_moderation_post_from_index from utils import local_actor_url from session import postJson from webfinger import webfingerHandle @@ -160,7 +160,7 @@ def outboxDelete(base_dir: str, http_prefix: str, print("DEBUG: you can't delete a post which " + "wasn't created by you (domain does not match)") return - removeModerationPostFromIndex(base_dir, messageId, debug) + remove_moderation_post_from_index(base_dir, messageId, debug) post_filename = locate_post(base_dir, deleteNickname, deleteDomain, messageId) if not post_filename: diff --git a/inbox.py b/inbox.py index f9d22f5e5..80b8a0d0f 100644 --- a/inbox.py +++ b/inbox.py @@ -53,7 +53,7 @@ from utils import get_domain_from_actor from utils import get_nickname_from_actor from utils import locate_post from utils import deletePost -from utils import removeModerationPostFromIndex +from utils import remove_moderation_post_from_index from utils import load_json from utils import save_json from utils import undo_likes_collection_entry @@ -1777,7 +1777,7 @@ def _receiveDelete(session, handle: str, isGroup: bool, base_dir: str, print('DEBUG: unknown recipient of like - ' + handle) # if this post in the outbox of the person? messageId = remove_id_ending(message_json['object']) - removeModerationPostFromIndex(base_dir, messageId, debug) + remove_moderation_post_from_index(base_dir, messageId, debug) handleNickname = handle.split('@')[0] handleDomain = handle.split('@')[1] post_filename = locate_post(base_dir, handleNickname, diff --git a/utils.py b/utils.py index 4076cda97..ae3b40cd2 100644 --- a/utils.py +++ b/utils.py @@ -1488,8 +1488,8 @@ def _removeAttachment(base_dir: str, http_prefix: str, domain: str, post_json['attachment'] = [] -def removeModerationPostFromIndex(base_dir: str, post_url: str, - debug: bool) -> None: +def remove_moderation_post_from_index(base_dir: str, post_url: str, + debug: bool) -> None: """Removes a url from the moderation index """ moderation_index_file = base_dir + '/accounts/moderation.txt' @@ -1557,8 +1557,8 @@ def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str, str(replies_filename)) -def _isBookmarked(base_dir: str, nickname: str, domain: str, - post_filename: str) -> bool: +def _is_bookmarked(base_dir: str, nickname: str, domain: str, + post_filename: str) -> bool: """Returns True if the given post is bookmarked """ bookmarks_index_filename = \ @@ -1737,7 +1737,7 @@ def deletePost(base_dir: str, http_prefix: str, return # don't allow deletion of bookmarked posts - if _isBookmarked(base_dir, nickname, domain, post_filename): + if _is_bookmarked(base_dir, nickname, domain, post_filename): return # don't remove replies to blog posts @@ -1777,7 +1777,7 @@ def deletePost(base_dir: str, http_prefix: str, if post_json_object['object'].get('moderationStatus'): if post_json_object.get('id'): post_id = remove_id_ending(post_json_object['id']) - removeModerationPostFromIndex(base_dir, post_id, debug) + remove_moderation_post_from_index(base_dir, post_id, debug) # remove any hashtags index entries if has_object: @@ -1900,8 +1900,8 @@ def validNickname(domain: str, nickname: str) -> bool: if not isValidLanguage(nickname): return False forbidden_chars = ('.', ' ', '/', '?', ':', ';', '@', '#', '!') - for c in forbidden_chars: - if c in nickname: + for char in forbidden_chars: + if char in nickname: return False # this should only apply for the shared inbox if nickname == domain: