mirror of https://gitlab.com/bashrc2/epicyon
Open content warning when replying to a post with cw, so you can see what you're replying to
parent
2c8d8825ce
commit
b4290f5f1a
|
@ -30,6 +30,7 @@ from utils import get_supported_languages
|
||||||
from utils import text_in_file
|
from utils import text_in_file
|
||||||
from utils import get_attributed_to
|
from utils import get_attributed_to
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
|
from webapp_utils import open_content_warning
|
||||||
from webapp_utils import edit_check_box
|
from webapp_utils import edit_check_box
|
||||||
from webapp_utils import get_buy_links
|
from webapp_utils import get_buy_links
|
||||||
from webapp_utils import html_following_data_list
|
from webapp_utils import html_following_data_list
|
||||||
|
@ -428,7 +429,7 @@ def html_new_post(edit_post_params: {},
|
||||||
minimize_all_images = False
|
minimize_all_images = False
|
||||||
if nickname in min_images_for_accounts:
|
if nickname in min_images_for_accounts:
|
||||||
minimize_all_images = True
|
minimize_all_images = True
|
||||||
new_post_text += \
|
replied_to_post = \
|
||||||
individual_post_as_html(signing_priv_key_pem,
|
individual_post_as_html(signing_priv_key_pem,
|
||||||
True, recent_posts_cache,
|
True, recent_posts_cache,
|
||||||
max_recent_posts,
|
max_recent_posts,
|
||||||
|
@ -456,6 +457,7 @@ def html_new_post(edit_post_params: {},
|
||||||
bold_reading, dogwhistles,
|
bold_reading, dogwhistles,
|
||||||
minimize_all_images, None,
|
minimize_all_images, None,
|
||||||
buy_sites, auto_cw_cache)
|
buy_sites, auto_cw_cache)
|
||||||
|
new_post_text += open_content_warning(replied_to_post)
|
||||||
# about the author
|
# about the author
|
||||||
if has_object_dict(post_json_object):
|
if has_object_dict(post_json_object):
|
||||||
if post_json_object['object'].get('attributedTo'):
|
if post_json_object['object'].get('attributedTo'):
|
||||||
|
|
|
@ -285,6 +285,12 @@ def get_content_warning_button(post_id: str, translate: {},
|
||||||
'</div></details>\n'
|
'</div></details>\n'
|
||||||
|
|
||||||
|
|
||||||
|
def open_content_warning(text: str) -> str:
|
||||||
|
"""Opens content warning when replying to a post with a cw
|
||||||
|
"""
|
||||||
|
return text.replace('<details>', '<div>').replace('</details>', '</div>')
|
||||||
|
|
||||||
|
|
||||||
def _set_actor_property_url(actor_json: {},
|
def _set_actor_property_url(actor_json: {},
|
||||||
property_name: str, url: str) -> None:
|
property_name: str, url: str) -> None:
|
||||||
"""Sets a url for the given actor property
|
"""Sets a url for the given actor property
|
||||||
|
|
Loading…
Reference in New Issue