Option to allow an account to be added to lists

main
bashrc 2026-07-21 17:35:36 +01:00
parent fb4ace531d
commit 37c895d112
2 changed files with 38 additions and 2 deletions

View File

@ -1340,6 +1340,29 @@ def _profile_post_reject_spam_actors(base_dir: str,
'EX: unable to remove reject spam actors') 'EX: unable to remove reject spam actors')
def _profile_post_allow_on_lists(base_dir: str,
nickname: str, domain: str,
fields: {}) -> None:
""" HTTP POST allow lists
"""
allow_on_lists: bool = False
if fields.get('allowLists'):
if fields['allowLists'] == 'on':
allow_on_lists = True
curr_allow_on_lists: bool = False
allow_on_lists_filename = \
acct_dir(base_dir, nickname, domain) + '/.allow_lists'
if is_a_file(allow_on_lists_filename):
curr_allow_on_lists = True
if allow_on_lists != curr_allow_on_lists:
if allow_on_lists:
save_flag_file(allow_on_lists_filename,
'EX: unable to write allow on lists')
else:
erase_file(allow_on_lists_filename,
'EX: unable to remove allow on lists')
def _profile_post_approve_followers(on_final_welcome_screen: bool, def _profile_post_approve_followers(on_final_welcome_screen: bool,
actor_json: {}, fields: {}, actor_json: {}, fields: {},
actor_changed: bool, actor_changed: bool,
@ -3237,6 +3260,8 @@ def profile_edit(self, calling_domain: str, cookie: str,
_profile_post_reject_spam_actors(base_dir, _profile_post_reject_spam_actors(base_dir,
nickname, domain, fields) nickname, domain, fields)
_profile_post_allow_on_lists(base_dir, nickname, domain,
fields)
actor_changed = \ actor_changed = \
_profile_post_keep_dms(base_dir, _profile_post_keep_dms(base_dir,

View File

@ -3371,7 +3371,8 @@ def _html_edit_profile_options(is_admin: bool,
hide_recent_posts: bool, hide_recent_posts: bool,
premium: bool, premium: bool,
no_seen_posts: bool, no_seen_posts: bool,
watermark_enabled: bool) -> str: watermark_enabled: bool,
allow_on_lists: bool) -> str:
"""option checkboxes section of edit profile screen """option checkboxes section of edit profile screen
""" """
edit_profile_form: str = ' <div class="container">\n' edit_profile_form: str = ' <div class="container">\n'
@ -3386,6 +3387,9 @@ def _html_edit_profile_options(is_admin: bool,
edit_profile_form += \ edit_profile_form += \
edit_check_box(translate['Reject spam accounts'], edit_check_box(translate['Reject spam accounts'],
'rejectSpamActors', reject_spam_actors) 'rejectSpamActors', reject_spam_actors)
edit_profile_form += \
edit_check_box(translate['Allow this account to be added to lists'],
'allowLists', allow_on_lists)
edit_profile_form += \ edit_profile_form += \
edit_check_box(translate['This is a bot account'], edit_check_box(translate['This is a bot account'],
'isBot', is_bot) 'isBot', is_bot)
@ -3933,6 +3937,12 @@ def html_edit_profile(server, translate: {},
if is_a_file(watermark_enabled_filename): if is_a_file(watermark_enabled_filename):
watermark_enabled = True watermark_enabled = True
# are other accounts permitted to add this one to lists?
allow_on_lists_filename: str = account_dir + '/.allow_lists'
allow_on_lists: bool = False
if is_a_file(allow_on_lists_filename):
allow_on_lists = True
# Option checkboxes # Option checkboxes
edit_profile_form += \ edit_profile_form += \
_html_edit_profile_options(is_admin, manually_approves_followers, _html_edit_profile_options(is_admin, manually_approves_followers,
@ -3945,7 +3955,8 @@ def html_edit_profile(server, translate: {},
reverse_sequence, show_quote_toots, reverse_sequence, show_quote_toots,
show_vote_posts, hide_follows, show_vote_posts, hide_follows,
hide_recent_posts, premium, hide_recent_posts, premium,
no_seen_posts, watermark_enabled) no_seen_posts, watermark_enabled,
allow_on_lists)
# reply controls # reply controls
edit_profile_form += \ edit_profile_form += \