From b52cc2d5bedd33a8cadb382f61652262923d2a2d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 26 Dec 2021 19:09:04 +0000 Subject: [PATCH] Snake case --- inbox.py | 8 ++++---- utils.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/inbox.py b/inbox.py index 4cf83d2ef..bf431ccb6 100644 --- a/inbox.py +++ b/inbox.py @@ -33,7 +33,7 @@ from utils import acct_dir from utils import remove_domain_port from utils import get_port_from_domain from utils import has_object_dict -from utils import dmAllowedFromDomain +from utils import dm_allowed_from_domain from utils import isRecentPost from utils import get_config_param from utils import has_users_path @@ -2945,9 +2945,9 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int, # check the follow if not isFollowingActor(base_dir, nickname, domain, sendH): # DMs may always be allowed from some domains - if not dmAllowedFromDomain(base_dir, - nickname, domain, - sendingActorDomain): + if not dm_allowed_from_domain(base_dir, + nickname, domain, + sendingActorDomain): # send back a bounce DM if post_json_object.get('id') and \ post_json_object.get('object'): diff --git a/utils.py b/utils.py index 764002692..d0edb8cd8 100644 --- a/utils.py +++ b/utils.py @@ -2701,20 +2701,20 @@ def loadTranslationsFromFile(base_dir: str, language: str) -> ({}, str): return load_json(translationsFile), system_language -def dmAllowedFromDomain(base_dir: str, - nickname: str, domain: str, - sendingActorDomain: str) -> bool: +def dm_allowed_from_domain(base_dir: str, + nickname: str, domain: str, + sending_actor_domain: str) -> bool: """When a DM is received and the .followDMs flag file exists Then optionally some domains can be specified as allowed, regardless of individual follows. i.e. Mostly you only want DMs from followers, but there are a few particular instances that you trust """ - dmAllowedInstancesFilename = \ + dm_allowed_instances_file = \ acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt' - if not os.path.isfile(dmAllowedInstancesFilename): + if not os.path.isfile(dm_allowed_instances_file): return False - if sendingActorDomain + '\n' in open(dmAllowedInstancesFilename).read(): + if sending_actor_domain + '\n' in open(dm_allowed_instances_file).read(): return True return False