mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
cdd1430c9b
commit
81ad6a7160
14
announce.py
14
announce.py
|
@ -20,7 +20,7 @@ from utils import getNicknameFromActor
|
|||
from utils import getDomainFromActor
|
||||
from utils import locate_post
|
||||
from utils import save_json
|
||||
from utils import undoAnnounceCollectionEntry
|
||||
from utils import undo_announce_collection_entry
|
||||
from utils import update_announce_collection
|
||||
from utils import local_actor_url
|
||||
from utils import replace_users_with_at
|
||||
|
@ -96,10 +96,10 @@ def outboxAnnounce(recent_posts_cache: {},
|
|||
post_filename = locate_post(base_dir, nickname, domain,
|
||||
message_json['object']['object'])
|
||||
if post_filename:
|
||||
undoAnnounceCollectionEntry(recent_posts_cache,
|
||||
base_dir, post_filename,
|
||||
message_json['actor'],
|
||||
domain, debug)
|
||||
undo_announce_collection_entry(recent_posts_cache,
|
||||
base_dir, post_filename,
|
||||
message_json['actor'],
|
||||
domain, debug)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -416,7 +416,7 @@ def outboxUndoAnnounce(recent_posts_cache: {},
|
|||
print('DEBUG: c2s undo announce post not found in inbox or outbox')
|
||||
print(messageId)
|
||||
return True
|
||||
undoAnnounceCollectionEntry(recent_posts_cache, base_dir, post_filename,
|
||||
message_json['actor'], domain, debug)
|
||||
undo_announce_collection_entry(recent_posts_cache, base_dir, post_filename,
|
||||
message_json['actor'], domain, debug)
|
||||
if debug:
|
||||
print('DEBUG: post undo announce via c2s - ' + post_filename)
|
||||
|
|
6
inbox.py
6
inbox.py
|
@ -87,7 +87,7 @@ from blocking import isBlockedDomain
|
|||
from blocking import broch_modeLapses
|
||||
from filters import isFiltered
|
||||
from utils import update_announce_collection
|
||||
from utils import undoAnnounceCollectionEntry
|
||||
from utils import undo_announce_collection_entry
|
||||
from utils import dangerousMarkup
|
||||
from utils import is_dm
|
||||
from utils import is_reply
|
||||
|
@ -2079,8 +2079,8 @@ def _receiveUndoAnnounce(recent_posts_cache: {},
|
|||
print("DEBUG: Attempt to undo something " +
|
||||
"which isn't an announcement")
|
||||
return False
|
||||
undoAnnounceCollectionEntry(recent_posts_cache, base_dir, post_filename,
|
||||
message_json['actor'], domain, debug)
|
||||
undo_announce_collection_entry(recent_posts_cache, base_dir, post_filename,
|
||||
message_json['actor'], domain, debug)
|
||||
if os.path.isfile(post_filename):
|
||||
try:
|
||||
os.remove(post_filename)
|
||||
|
|
9
utils.py
9
utils.py
|
@ -2339,9 +2339,10 @@ def undoReactionCollectionEntry(recent_posts_cache: {},
|
|||
save_json(post_json_object, post_filename)
|
||||
|
||||
|
||||
def undoAnnounceCollectionEntry(recent_posts_cache: {},
|
||||
base_dir: str, post_filename: str,
|
||||
actor: str, domain: str, debug: bool) -> None:
|
||||
def undo_announce_collection_entry(recent_posts_cache: {},
|
||||
base_dir: str, post_filename: str,
|
||||
actor: str, domain: str,
|
||||
debug: bool) -> None:
|
||||
"""Undoes an announce for a particular actor by removing it from
|
||||
the "shares" collection within a post. Note that the "shares"
|
||||
collection has no relation to shared items in shares.py. It's
|
||||
|
@ -2362,7 +2363,7 @@ def undoAnnounceCollectionEntry(recent_posts_cache: {},
|
|||
os.remove(cachedPostFilename)
|
||||
except OSError:
|
||||
if debug:
|
||||
print('EX: undoAnnounceCollectionEntry ' +
|
||||
print('EX: undo_announce_collection_entry ' +
|
||||
'unable to delete cached post ' +
|
||||
str(cachedPostFilename))
|
||||
removePostFromCache(post_json_object, recent_posts_cache)
|
||||
|
|
Loading…
Reference in New Issue