Snake case

merge-requests/30/head
Bob Mottram 2021-12-26 19:09:04 +00:00
parent d32d6eb86d
commit b52cc2d5be
2 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@ from utils import acct_dir
from utils import remove_domain_port from utils import remove_domain_port
from utils import get_port_from_domain from utils import get_port_from_domain
from utils import has_object_dict from utils import has_object_dict
from utils import dmAllowedFromDomain from utils import dm_allowed_from_domain
from utils import isRecentPost from utils import isRecentPost
from utils import get_config_param from utils import get_config_param
from utils import has_users_path from utils import has_users_path
@ -2945,9 +2945,9 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
# check the follow # check the follow
if not isFollowingActor(base_dir, nickname, domain, sendH): if not isFollowingActor(base_dir, nickname, domain, sendH):
# DMs may always be allowed from some domains # DMs may always be allowed from some domains
if not dmAllowedFromDomain(base_dir, if not dm_allowed_from_domain(base_dir,
nickname, domain, nickname, domain,
sendingActorDomain): sendingActorDomain):
# send back a bounce DM # send back a bounce DM
if post_json_object.get('id') and \ if post_json_object.get('id') and \
post_json_object.get('object'): post_json_object.get('object'):

View File

@ -2701,20 +2701,20 @@ def loadTranslationsFromFile(base_dir: str, language: str) -> ({}, str):
return load_json(translationsFile), system_language return load_json(translationsFile), system_language
def dmAllowedFromDomain(base_dir: str, def dm_allowed_from_domain(base_dir: str,
nickname: str, domain: str, nickname: str, domain: str,
sendingActorDomain: str) -> bool: sending_actor_domain: str) -> bool:
"""When a DM is received and the .followDMs flag file exists """When a DM is received and the .followDMs flag file exists
Then optionally some domains can be specified as allowed, Then optionally some domains can be specified as allowed,
regardless of individual follows. regardless of individual follows.
i.e. Mostly you only want DMs from followers, but there are i.e. Mostly you only want DMs from followers, but there are
a few particular instances that you trust a few particular instances that you trust
""" """
dmAllowedInstancesFilename = \ dm_allowed_instances_file = \
acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt' 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 return False
if sendingActorDomain + '\n' in open(dmAllowedInstancesFilename).read(): if sending_actor_domain + '\n' in open(dm_allowed_instances_file).read():
return True return True
return False return False