Don't show reply icon if you are probably blocked

merge-requests/30/head
Bob Mottram 2024-12-24 13:22:52 +00:00
parent 8dd7a82d10
commit 3301d430b6
3 changed files with 30 additions and 12 deletions

Binary file not shown.

View File

@ -386,13 +386,15 @@ prompt you to add a profile picture, name and bio description.</p>
</figure> </figure>
<h1 id="account-profiles">Account Profiles</h1> <h1 id="account-profiles">Account Profiles</h1>
<h2 id="initial-setup">Initial setup</h2> <h2 id="initial-setup">Initial setup</h2>
<p>When you first register an account on the instance the first thing <p>When you register an account on the instance the first thing that you
that you may want to do is to add more profile details and change your may want to do is to add more profile details and change your
preferences. From the main timeline screen select the top banner to move preferences. From the main timeline screen select the top banner to move
to your profile and then select the edit button, which usually looks to your profile and then select the edit button, which usually looks
like a pen and is adjacent to the logout icon.</p> like a pen and is adjacent to the logout icon.</p>
<p><img src="manual-profile.jpg" alt="Profile screen" /> <img <figure>
src="manual-edit-button.png" alt="Profile edit button" /></p> <img src="manual-edit-button.png" alt="Profile edit button" />
<figcaption aria-hidden="true">Profile edit button</figcaption>
</figure>
<h2 id="basic-details">Basic details</h2> <h2 id="basic-details">Basic details</h2>
<figure> <figure>
<img src="manual-basic-details.png" alt="Profile basic details" /> <img src="manual-basic-details.png" alt="Profile basic details" />

View File

@ -35,6 +35,7 @@ from flags import is_news_post
from flags import is_recent_post from flags import is_recent_post
from flags import is_chat_message from flags import is_chat_message
from flags import is_pgp_encrypted from flags import is_pgp_encrypted
from utils import text_in_file
from utils import text_mode_removals from utils import text_mode_removals
from utils import remove_header_tags from utils import remove_header_tags
from utils import get_actor_from_post_id from utils import get_actor_from_post_id
@ -643,6 +644,25 @@ def _get_reply_icon_html(base_dir: str, nickname: str, domain: str,
reply_to_link += '?mention=' + actor_url reply_to_link += '?mention=' + actor_url
if len(reply_to_link) > 500: if len(reply_to_link) > 500:
break break
# Is this domain or account blocking you?
reply_to_domain, _ = get_domain_from_actor(reply_to_link)
reply_to_actor = get_actor_from_post(post_json_object)
if reply_to_domain:
send_block_filename = \
acct_dir(base_dir, nickname, domain) + '/send_blocks.txt'
if os.path.isfile(send_block_filename):
reply_blocked = False
if text_in_file(reply_to_actor, send_block_filename, False):
reply_blocked = True
elif text_in_file('://' + reply_to_domain + '\n',
send_block_filename, False):
reply_blocked = True
if reply_blocked:
# You are blocked. Replies are unlikely to be received
# so don't show the reply icon
return ''
reply_to_link += page_number_param reply_to_link += page_number_param
reply_str = '' reply_str = ''
@ -657,19 +677,17 @@ def _get_reply_icon_html(base_dir: str, nickname: str, domain: str,
if isinstance(convthread_id, str): if isinstance(convthread_id, str):
conversation_str = '?convthreadId=' + convthread_id conversation_str = '?convthreadId=' + convthread_id
if is_public_reply: if is_public_reply:
actor_url = get_actor_from_post(post_json_object)
reply_str += \ reply_str += \
' <a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?replyto=' + reply_to_link + \ nickname + '?replyto=' + reply_to_link + \
'?actor=' + actor_url + \ '?actor=' + reply_to_actor + \
conversation_str + \ conversation_str + \
'" title="' + reply_to_this_post_str + '" tabindex="10">\n' '" title="' + reply_to_this_post_str + '" tabindex="10">\n'
elif is_unlisted_reply: elif is_unlisted_reply:
actor_url = get_actor_from_post(post_json_object)
reply_str += \ reply_str += \
' <a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?replyunlisted=' + reply_to_link + \ nickname + '?replyunlisted=' + reply_to_link + \
'?actor=' + actor_url + \ '?actor=' + reply_to_actor + \
conversation_str + \ conversation_str + \
'" title="' + reply_to_this_post_str + '" tabindex="10">\n' '" title="' + reply_to_this_post_str + '" tabindex="10">\n'
else: else:
@ -677,21 +695,19 @@ def _get_reply_icon_html(base_dir: str, nickname: str, domain: str,
reply_type = 'replydm' reply_type = 'replydm'
if is_chat_message(post_json_object): if is_chat_message(post_json_object):
reply_type = 'replychat' reply_type = 'replychat'
actor_url = get_actor_from_post(post_json_object)
reply_str += \ reply_str += \
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + nickname + \ '<a class="imageAnchor" href="/users/' + nickname + \
'?' + reply_type + '=' + reply_to_link + \ '?' + reply_type + '=' + reply_to_link + \
'?actor=' + actor_url + \ '?actor=' + reply_to_actor + \
conversation_str + \ conversation_str + \
'" title="' + reply_to_this_post_str + '" tabindex="10">\n' '" title="' + reply_to_this_post_str + '" tabindex="10">\n'
else: else:
actor_url = get_actor_from_post(post_json_object)
reply_str += \ reply_str += \
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + nickname + \ '<a class="imageAnchor" href="/users/' + nickname + \
'?replyfollowers=' + reply_to_link + \ '?replyfollowers=' + reply_to_link + \
'?actor=' + actor_url + \ '?actor=' + reply_to_actor + \
conversation_str + \ conversation_str + \
'" title="' + reply_to_this_post_str + '" tabindex="10">\n' '" title="' + reply_to_this_post_str + '" tabindex="10">\n'