diff --git a/daemon.py b/daemon.py index 8c8325026..c099fbdcd 100644 --- a/daemon.py +++ b/daemon.py @@ -179,6 +179,7 @@ from webapp_accesskeys import html_access_keys from webapp_accesskeys import load_access_keys_for_accounts from webapp_confirm import html_confirm_delete from webapp_confirm import html_confirm_remove_shared_item +from webapp_confirm import html_confirm_block from webapp_confirm import html_confirm_unblock from webapp_person_options import person_minimize_images from webapp_person_options import person_undo_minimize_images @@ -3057,16 +3058,20 @@ class PubServer(BaseHTTPRequestHandler): # person options screen, block button # See html_person_options if '&submitBlock=' in options_confirm_params: - print('Adding block by ' + chooser_nickname + - ' of ' + options_actor) - if add_block(base_dir, chooser_nickname, - domain, - options_nickname, options_domain_full): - # send block activity - self._send_block(http_prefix, - chooser_nickname, domain_full, - options_nickname, options_domain_full, - curr_session, proxy_type) + if debug: + print('Blocking ' + options_actor) + msg = \ + html_confirm_block(self.server.translate, + base_dir, + users_path, + options_actor, + options_avatar_url).encode('utf-8') + msglen = len(msg) + self._set_headers('text/html', msglen, + cookie, calling_domain, False) + self._write(msg) + self.server.postreq_busy = False + return # person options screen, unblock button # See html_person_options diff --git a/utils.py b/utils.py index ddcffbf9a..b3991cc09 100644 --- a/utils.py +++ b/utils.py @@ -3790,6 +3790,7 @@ def disallow_reply(content: str) -> bool: 'dont_at_me', 'do not reply', "don't reply", + "don't @ me", 'DontAtMe' ) for diss in disallow_strings: diff --git a/webapp_confirm.py b/webapp_confirm.py index e95c58e45..9d2034b36 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -335,3 +335,50 @@ def html_confirm_unblock(translate: {}, base_dir: str, block_str += '\n' block_str += html_footer() return block_str + + +def html_confirm_block(translate: {}, base_dir: str, + origin_path_str: str, + block_actor: str, + block_profile_url: str) -> str: + """Asks to confirm blocking an actor + """ + block_domain, _ = get_domain_from_actor(block_actor) + + set_custom_background(base_dir, 'block-background', 'follow-background') + + css_filename = base_dir + '/epicyon-follow.css' + if os.path.isfile(base_dir + '/follow.css'): + css_filename = base_dir + '/follow.css' + + instance_title = get_config_param(base_dir, 'instanceTitle') + block_str = html_header_with_external_style(css_filename, + instance_title, None) + block_str += '
\n' + block_str += '
\n' + block_str += '
\n' + block_str += ' \n' + block_str += \ + ' \n' + block_actor_nick = get_nickname_from_actor(block_actor) + if block_actor_nick: + block_str += \ + '

' + translate['Block'] + ' ' + \ + block_actor_nick + '@' + block_domain + ' ?

\n' + block_str += '
\n' + block_str += ' \n' + block_str += \ + ' \n' + block_str += \ + ' \n' + block_str += '
\n' + block_str += '
\n' + block_str += '
\n' + block_str += '
\n' + block_str += html_footer() + return block_str diff --git a/webapp_person_options.py b/webapp_person_options.py index 5d2d22a9d..2b152b075 100644 --- a/webapp_person_options.py +++ b/webapp_person_options.py @@ -522,10 +522,6 @@ def html_person_options(default_timeline: str, follow_str + \ '" accesskey="' + access_keys['followButton'] + '">' + \ translate[follow_str] + '\n' - options_str += \ - ' \n' options_str += \ ' \n' + options_str += \ + ' \n' person_notes = '' if origin_path_str == '/users/' + nickname: