Warn when replying to an account or instance which may be blocking

main
Bob Mottram 2023-09-17 15:46:01 +01:00
parent a3df7759f4
commit 9f06d35351
1 changed files with 28 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from utils import get_currencies
from utils import get_category_types
from utils import get_account_timezone
from utils import get_supported_languages
from utils import text_in_file
from webapp_utils import edit_check_box
from webapp_utils import get_buy_links
from webapp_utils import html_following_data_list
@ -373,6 +374,33 @@ def html_new_post(edit_post_params: {},
'" rel="nofollow noopener noreferrer" ' + \
'target="_blank">' + \
translate['this post'] + '</a></p>\n'
# is sending posts to this account blocked?
send_block_filename = \
acct_dir(base_dir, nickname, domain) + \
'/send_blocks.txt'
if os.path.isfile(send_block_filename):
reply_actor = in_reply_to
reply_nickname = get_nickname_from_actor(in_reply_to)
if reply_nickname:
reply_actor = \
in_reply_to.split('/' + reply_nickname)[0] + \
'/' + reply_nickname
if text_in_file(reply_actor,
send_block_filename, False):
new_post_text += \
' <p class="new-post-text"><b>' + \
translate['FollowAccountWarning'] + \
'</b></p>\n'
else:
reply_domain, _ = \
get_domain_from_actor(reply_actor)
if text_in_file('://' + reply_domain + '\n',
send_block_filename, False):
new_post_text += \
' <p class="new-post-text"><b>' + \
translate['FollowWarning'] + '</b></p>\n'
if post_json_object:
timezone = \
get_account_timezone(base_dir, nickname, domain)