Avoid using default paramerers so that static analysis works better

merge-requests/30/head
Bob Mottram 2024-02-11 13:27:52 +00:00
parent e2ee8d994a
commit 4233310044
5 changed files with 13 additions and 8 deletions

View File

@ -783,8 +783,8 @@ def is_blocked_nickname(base_dir: str, nickname: str,
def is_blocked(base_dir: str, nickname: str, domain: str, def is_blocked(base_dir: str, nickname: str, domain: str,
block_nickname: str, block_domain: str, block_nickname: str, block_domain: str,
blocked_cache: [] = None, blocked_cache: [],
block_federated: [] = None) -> bool: block_federated: []) -> bool:
"""Is the given account blocked? """Is the given account blocked?
""" """
if is_evil(block_domain): if is_evil(block_domain):

View File

@ -172,7 +172,8 @@ def html_account_info(translate: {},
return '' return ''
follower_domain_full = get_full_domain(follower_domain, follower_port) follower_domain_full = get_full_domain(follower_domain, follower_port)
if is_blocked(base_dir, nickname, domain, if is_blocked(base_dir, nickname, domain,
follower_nickname, follower_domain_full): follower_nickname, follower_domain_full,
None, None):
blocked_followers.append(follower_actor) blocked_followers.append(follower_actor)
# get a list of any blocked following # get a list of any blocked following
@ -192,7 +193,8 @@ def html_account_info(translate: {},
following_domain_full = \ following_domain_full = \
get_full_domain(following_domain, following_port) get_full_domain(following_domain, following_port)
if is_blocked(base_dir, nickname, domain, if is_blocked(base_dir, nickname, domain,
following_nickname, following_domain_full): following_nickname, following_domain_full,
None, None):
blocked_following.append(following_actor) blocked_following.append(following_actor)
info_form += '<div class="accountInfoDomains">\n' info_form += '<div class="accountInfoDomains">\n'

View File

@ -217,7 +217,8 @@ def html_person_options(default_timeline: str,
nickname, domain, nickname, domain,
options_nickname, options_domain_full) options_nickname, options_domain_full)
if is_blocked(base_dir, nickname, domain, if is_blocked(base_dir, nickname, domain,
options_nickname, options_domain_full): options_nickname, options_domain_full,
None, None):
block_str = 'Unblock' block_str = 'Unblock'
if options_link: if options_link:
@ -335,7 +336,8 @@ def html_person_options(default_timeline: str,
new_handle = new_nickname + '@' + new_domain new_handle = new_nickname + '@' + new_domain
blocked_icon_str = '' blocked_icon_str = ''
if is_blocked(base_dir, nickname, domain, if is_blocked(base_dir, nickname, domain,
new_nickname, new_domain, blocked_cache): new_nickname, new_domain, blocked_cache,
None):
blocked_icon_str = '' blocked_icon_str = ''
options_str += \ options_str += \
' <p class="optionsText">' + \ ' <p class="optionsText">' + \

View File

@ -590,7 +590,7 @@ def _get_reply_icon_html(base_dir: str, nickname: str, domain: str,
get_domain_from_actor(post_json_object['object']['replyTo']) get_domain_from_actor(post_json_object['object']['replyTo'])
if block_domain: if block_domain:
if not is_blocked(base_dir, nickname, domain, if not is_blocked(base_dir, nickname, domain,
block_nickname, block_domain, {}): block_nickname, block_domain, {}, None):
reply_to_link = post_json_object['object']['replyTo'] reply_to_link = post_json_object['object']['replyTo']
if post_json_object['object'].get('attributedTo'): if post_json_object['object'].get('attributedTo'):

View File

@ -431,7 +431,8 @@ def html_profile_after_search(authorized: bool,
follow_is_permitted = False follow_is_permitted = False
blocked = \ blocked = \
is_blocked(base_dir, nickname, domain, search_nickname, search_domain) is_blocked(base_dir, nickname, domain, search_nickname, search_domain,
None, None)
if follow_is_permitted: if follow_is_permitted:
follow_str = 'Follow' follow_str = 'Follow'