Snake case

merge-requests/30/head
Bob Mottram 2021-12-28 13:12:10 +00:00
parent 302090e039
commit e31a7a7679
3 changed files with 12 additions and 12 deletions

View File

@ -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:

View File

@ -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,

View File

@ -1488,7 +1488,7 @@ def _removeAttachment(base_dir: str, http_prefix: str, domain: str,
post_json['attachment'] = []
def removeModerationPostFromIndex(base_dir: str, post_url: str,
def remove_moderation_post_from_index(base_dir: str, post_url: str,
debug: bool) -> None:
"""Removes a url from the moderation index
"""
@ -1557,7 +1557,7 @@ def _deletePostRemoveReplies(base_dir: str, nickname: str, domain: str,
str(replies_filename))
def _isBookmarked(base_dir: str, nickname: str, domain: str,
def _is_bookmarked(base_dir: str, nickname: str, domain: str,
post_filename: str) -> bool:
"""Returns True if the given post is bookmarked
"""
@ -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: