Snake case

merge-requests/30/head
Bob Mottram 2021-12-27 23:02:50 +00:00
parent d9ee8a3ff8
commit 4246688359
4 changed files with 36 additions and 34 deletions

View File

@ -243,7 +243,7 @@ from languages import getActorLanguages
from languages import setActorLanguages from languages import setActorLanguages
from like import updateLikesCollection from like import updateLikesCollection
from reaction import updateReactionCollection from reaction import updateReactionCollection
from utils import undoReactionCollectionEntry from utils import undo_reaction_collection_entry
from utils import get_new_post_endpoints from utils import get_new_post_endpoints
from utils import has_actor from utils import has_actor
from utils import setReplyIntervalHours from utils import setReplyIntervalHours
@ -8704,21 +8704,22 @@ class PubServer(BaseHTTPRequestHandler):
recent_posts_cache = self.server.recent_posts_cache recent_posts_cache = self.server.recent_posts_cache
reactionPostJson = load_json(reactionPostFilename, 0, 1) reactionPostJson = load_json(reactionPostFilename, 0, 1)
if origFilename and origPostUrl: if origFilename and origPostUrl:
undoReactionCollectionEntry(recent_posts_cache, undo_reaction_collection_entry(recent_posts_cache,
base_dir, reactionPostFilename, base_dir,
reactionUrl, reactionPostFilename,
undoActor, domain, debug, reactionUrl,
reactionPostJson, undoActor, domain, debug,
emojiContent) reactionPostJson,
emojiContent)
reactionUrl = origPostUrl reactionUrl = origPostUrl
reactionPostFilename = origFilename reactionPostFilename = origFilename
if debug: if debug:
print('Removing emoji reaction for ' + reactionPostFilename) print('Removing emoji reaction for ' + reactionPostFilename)
undoReactionCollectionEntry(recent_posts_cache, undo_reaction_collection_entry(recent_posts_cache,
base_dir, base_dir,
reactionPostFilename, reactionUrl, reactionPostFilename, reactionUrl,
undoActor, domain, debug, undoActor, domain, debug,
reactionPostJson, emojiContent) reactionPostJson, emojiContent)
if debug: if debug:
print('Regenerating html post for changed ' + print('Regenerating html post for changed ' +
'emoji reaction collection') 'emoji reaction collection')

View File

@ -57,7 +57,7 @@ from utils import removeModerationPostFromIndex
from utils import load_json from utils import load_json
from utils import save_json from utils import save_json
from utils import undoLikesCollectionEntry from utils import undoLikesCollectionEntry
from utils import undoReactionCollectionEntry from utils import undo_reaction_collection_entry
from utils import has_group_type from utils import has_group_type
from utils import local_actor_url from utils import local_actor_url
from utils import has_object_stringType from utils import has_object_stringType
@ -1446,9 +1446,9 @@ def _receiveUndoReaction(recent_posts_cache: {},
if debug: if debug:
print('DEBUG: unreaction has no content') print('DEBUG: unreaction has no content')
return True return True
undoReactionCollectionEntry(recent_posts_cache, base_dir, post_filename, undo_reaction_collection_entry(recent_posts_cache, base_dir, post_filename,
postReactionId, reactionActor, domain, postReactionId, reactionActor, domain,
debug, None, emojiContent) debug, None, emojiContent)
# regenerate the html # regenerate the html
reactionPostJson = load_json(post_filename, 0, 1) reactionPostJson = load_json(post_filename, 0, 1)
if reactionPostJson: if reactionPostJson:
@ -1463,13 +1463,14 @@ def _receiveUndoReaction(recent_posts_cache: {},
if announceReactionFilename: if announceReactionFilename:
postReactionId = announceReactionUrl postReactionId = announceReactionUrl
post_filename = announceReactionFilename post_filename = announceReactionFilename
undoReactionCollectionEntry(recent_posts_cache, undo_reaction_collection_entry(recent_posts_cache,
base_dir, base_dir,
post_filename, post_filename,
postReactionId, postReactionId,
reactionActor, domain, reactionActor,
debug, None, domain,
emojiContent) debug, None,
emojiContent)
if reactionPostJson: if reactionPostJson:
if debug: if debug:
cachedPostFilename = \ cachedPostFilename = \

View File

@ -23,7 +23,7 @@ from utils import url_permitted
from utils import get_nickname_from_actor from utils import get_nickname_from_actor
from utils import get_domain_from_actor from utils import get_domain_from_actor
from utils import locate_post from utils import locate_post
from utils import undoReactionCollectionEntry from utils import undo_reaction_collection_entry
from utils import has_group_type from utils import has_group_type
from utils import local_actor_url from utils import local_actor_url
from utils import load_json from utils import load_json
@ -432,9 +432,9 @@ def outboxUndoReaction(recent_posts_cache: {},
print('DEBUG: c2s undo reaction post not found in inbox or outbox') print('DEBUG: c2s undo reaction post not found in inbox or outbox')
print(messageId) print(messageId)
return True return True
undoReactionCollectionEntry(recent_posts_cache, base_dir, post_filename, undo_reaction_collection_entry(recent_posts_cache, base_dir, post_filename,
messageId, message_json['actor'], messageId, message_json['actor'],
domain, debug, None, emojiContent) domain, debug, None, emojiContent)
if debug: if debug:
print('DEBUG: post undo reaction via c2s - ' + post_filename) print('DEBUG: post undo reaction via c2s - ' + post_filename)

View File

@ -2276,12 +2276,12 @@ def undoLikesCollectionEntry(recent_posts_cache: {},
save_json(post_json_object, post_filename) save_json(post_json_object, post_filename)
def undoReactionCollectionEntry(recent_posts_cache: {}, def undo_reaction_collection_entry(recent_posts_cache: {},
base_dir: str, post_filename: str, base_dir: str, post_filename: str,
objectUrl: str, objectUrl: str,
actor: str, domain: str, debug: bool, actor: str, domain: str, debug: bool,
post_json_object: {}, post_json_object: {},
emojiContent: str) -> None: emojiContent: str) -> None:
"""Undoes an emoji reaction for a particular actor """Undoes an emoji reaction for a particular actor
""" """
if not post_json_object: if not post_json_object:
@ -2299,7 +2299,7 @@ def undoReactionCollectionEntry(recent_posts_cache: {},
try: try:
os.remove(cached_post_filename) os.remove(cached_post_filename)
except OSError: except OSError:
print('EX: undoReactionCollectionEntry ' + print('EX: undo_reaction_collection_entry ' +
'unable to delete cached post ' + 'unable to delete cached post ' +
str(cached_post_filename)) str(cached_post_filename))
remove_post_from_cache(post_json_object, recent_posts_cache) remove_post_from_cache(post_json_object, recent_posts_cache)