Snake case

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

View File

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

View File

@ -23,7 +23,7 @@ from utils import url_permitted
from utils import get_nickname_from_actor
from utils import get_domain_from_actor
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 local_actor_url
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(messageId)
return True
undoReactionCollectionEntry(recent_posts_cache, base_dir, post_filename,
messageId, message_json['actor'],
domain, debug, None, emojiContent)
undo_reaction_collection_entry(recent_posts_cache, base_dir, post_filename,
messageId, message_json['actor'],
domain, debug, None, emojiContent)
if debug:
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)
def undoReactionCollectionEntry(recent_posts_cache: {},
base_dir: str, post_filename: str,
objectUrl: str,
actor: str, domain: str, debug: bool,
post_json_object: {},
emojiContent: str) -> None:
def undo_reaction_collection_entry(recent_posts_cache: {},
base_dir: str, post_filename: str,
objectUrl: str,
actor: str, domain: str, debug: bool,
post_json_object: {},
emojiContent: str) -> None:
"""Undoes an emoji reaction for a particular actor
"""
if not post_json_object:
@ -2299,7 +2299,7 @@ def undoReactionCollectionEntry(recent_posts_cache: {},
try:
os.remove(cached_post_filename)
except OSError:
print('EX: undoReactionCollectionEntry ' +
print('EX: undo_reaction_collection_entry ' +
'unable to delete cached post ' +
str(cached_post_filename))
remove_post_from_cache(post_json_object, recent_posts_cache)