diff --git a/src/daemon_post_profile.py b/src/daemon_post_profile.py index c8a0ed61a..ac24537b2 100644 --- a/src/daemon_post_profile.py +++ b/src/daemon_post_profile.py @@ -1340,6 +1340,29 @@ def _profile_post_reject_spam_actors(base_dir: str, '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, actor_json: {}, fields: {}, actor_changed: bool, @@ -3237,6 +3260,8 @@ def profile_edit(self, calling_domain: str, cookie: str, _profile_post_reject_spam_actors(base_dir, nickname, domain, fields) + _profile_post_allow_on_lists(base_dir, nickname, domain, + fields) actor_changed = \ _profile_post_keep_dms(base_dir, diff --git a/src/webapp_profile.py b/src/webapp_profile.py index a290037a6..61c7c918b 100644 --- a/src/webapp_profile.py +++ b/src/webapp_profile.py @@ -3371,7 +3371,8 @@ def _html_edit_profile_options(is_admin: bool, hide_recent_posts: bool, premium: bool, no_seen_posts: bool, - watermark_enabled: bool) -> str: + watermark_enabled: bool, + allow_on_lists: bool) -> str: """option checkboxes section of edit profile screen """ edit_profile_form: str = '
\n' @@ -3386,6 +3387,9 @@ def _html_edit_profile_options(is_admin: bool, edit_profile_form += \ edit_check_box(translate['Reject spam accounts'], '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_check_box(translate['This is a bot account'], 'isBot', is_bot) @@ -3933,6 +3937,12 @@ def html_edit_profile(server, translate: {}, if is_a_file(watermark_enabled_filename): 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 edit_profile_form += \ _html_edit_profile_options(is_admin, manually_approves_followers, @@ -3945,7 +3955,8 @@ def html_edit_profile(server, translate: {}, reverse_sequence, show_quote_toots, show_vote_posts, hide_follows, hide_recent_posts, premium, - no_seen_posts, watermark_enabled) + no_seen_posts, watermark_enabled, + allow_on_lists) # reply controls edit_profile_form += \