2024-05-30 21:54:25 +12:00
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') -%}
{% extends 'themes/' + theme() + '/base.html' -%}
{% else -%}
{% extends "base.html" -%}
{% endif -%} -%}
{% from 'bootstrap/form.html' import render_form -%}
2023-10-02 22:16:44 +13:00
2024-05-30 21:54:25 +12:00
{% block app_content -%}
2023-10-23 22:54:11 +13:00
< script type = "text/javascript" nonce = "{{ session['nonce'] }}" >
var toBeHidden = Array(); // this list of comment IDs will be iterated over in setupHideButtons() and the 'hide' button clicked
< / script >
2023-10-02 22:16:44 +13:00
< div class = "row" >
2023-11-09 21:32:29 +13:00
< div class = "col-12 col-md-8 position-relative main_pane" >
2024-05-30 21:54:25 +12:00
{% include 'post/_post_full.html' -%}
{% if post.comments_enabled -%}
{% if current_user.is_authenticated -%}
{% if current_user.verified -%}
2023-10-23 13:03:35 +13:00
< div class = "row post_reply_form" >
2023-11-09 21:32:29 +13:00
< hr class = "mt-1" / >
2023-10-23 13:03:35 +13:00
< div class = "col" >
2023-11-30 23:21:37 +13:00
< div class = "reply_form_inner position-relative" >
2024-05-30 21:54:25 +12:00
{% if post.community.ap_id and '@beehaw.org' in post.community.ap_id -%}
2024-02-28 22:25:34 +13:00
< p > {{ _('This post is hosted on beehaw.org which has < a href = "https://docs.beehaw.org/docs/core-principles/what-is-beehaw/" target = "_blank" rel = "nofollow" > higher standards of behaviour than most places. Be nice< / a > .') }}< / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if post.community.posting_warning -%}
2024-04-18 20:51:08 +12:00
< p align = "center" > {{ post.community.posting_warning|safe }}< / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-23 13:03:35 +13:00
{{ render_form(form) }}
2024-05-30 21:54:25 +12:00
{% if not low_bandwidth -%}
{% if markdown_editor -%}
2024-02-28 20:12:57 +13:00
< script nonce = "{{ session['nonce'] }}" >
window.addEventListener("load", function () {
var downarea = new DownArea({
elem: document.querySelector('#body'),
resize: DownArea.RESIZE_VERTICAL,
hide: ['heading', 'bold-italic'],
});
setupAutoResize('body');
2023-12-26 10:49:08 +13:00
});
2024-02-28 20:12:57 +13:00
< / script >
2024-05-30 21:54:25 +12:00
{% else -%}
2024-05-09 17:54:30 +12:00
<!-- <a href="#" aria - hidden="true" id="post_reply_markdown_editor_enabler" class="markdown_editor_enabler" data - id="body">{{ _('Enable markdown editor') }}</a> -->
2024-05-30 21:54:25 +12:00
{% endif -%}
{% endif -%}
2023-10-23 13:03:35 +13:00
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% if replies -%}
2023-10-23 13:03:35 +13:00
< hr class = "mt-4" / >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-23 13:03:35 +13:00
< / div >
2024-05-30 21:54:25 +12:00
{% else -%}
2023-10-23 13:03:35 +13:00
< p > < a href = "{{ url_for('auth.validation_required') }}" > {{ _('Verify your email address to comment') }}< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% else -%}
2024-02-28 22:03:26 +13:00
< p > < a href = "{{ url_for('auth.login', next='/post/' + str(post.id)) }}" > {{ _('Log in to comment') }}< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% else -%}
2023-12-14 21:22:46 +13:00
< p > {{ _('Comments are disabled.') }}< / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if replies -%}
2024-02-29 22:45:17 +13:00
< h2 class = "visually-hidden" > {{ post.reply_count }} {{ _('Comments') }}< / h2 >
2024-01-07 22:28:13 +13:00
< div id = "post_replies" class = "row" >
2023-10-02 22:16:44 +13:00
< div class = "col" >
2024-01-07 22:28:13 +13:00
< div class = "btn-group mt-1 mb-2" >
2024-02-13 19:14:51 +13:00
< a href = "?sort=hot#post_replies" title = "{{ _('Sort by magic') }}" class = "btn btn-sm {{ 'btn-primary' if request.args.get('sort', '') == '' or request.args.get('sort', '') == 'hot' else 'btn-outline-secondary' }}" rel = "nofollow noindex" >
2024-01-07 22:28:13 +13:00
{{ _('Hot') }}
< / a >
2024-02-13 19:14:51 +13:00
< a href = "?sort=top#post_replies" title = "{{ _('Comments with the most upvotes') }}" class = "btn btn-sm {{ 'btn-primary' if request.args.get('sort', '') == 'top' else 'btn-outline-secondary' }}" rel = "nofollow noindex" >
2024-01-07 22:28:13 +13:00
{{ _('Top') }}
< / a >
2024-02-13 19:14:51 +13:00
< a href = "?sort=new#post_replies" title = "{{ _('Show newest first') }}" class = "btn btn-sm {{ 'btn-primary' if request.args.get('sort', '') == 'new' else 'btn-outline-secondary' }}" rel = "nofollow noindex" >
2024-01-07 22:28:13 +13:00
{{ _('New') }}
< / a >
< / div >
2024-05-30 21:54:25 +12:00
{% macro render_comment(comment) -%}
< div id = "comment_{{ comment['comment'].id }}" class = "comment { % if comment [ ' comment ' ] . score < = -10 - % } low_score { % endif - % }
{% if comment['comment'].author.id == post.author.id -%}original_poster{% endif -%}" aria-level="{{ comment['comment'].depth + 1 }}" role="treeitem" aria-expanded="true" tabindex="0">
< div class = "limit_height" > {% if not comment['comment'].author.indexable -%}<!-- googleoff: all --> {% endif -%}
2023-10-15 21:13:32 +13:00
< div class = "comment_author" >
2024-07-04 14:23:00 +02:00
{% with collapsed = comment['comment'].score < reply_collapse_threshold - % }
{{ render_username(comment['comment'].author) }}
{% endwith -%}
2024-07-01 18:17:27 +08:00
{% if comment['comment'].author.id == post.author.id -%}< span title = "Submitter of original post" aria-label = "{{ _('Post creator') }}" class = "small" > [OP] < / span > {% endif -%}
2024-05-30 21:54:25 +12:00
< span class = "text-muted small" aria_label = "{{ _('When: ') }}" > {{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at -%}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif -%}< / span >
2024-01-16 21:39:10 +13:00
< a class = "unhide" href = "#" > < span class = "fe fe-expand" > < / span > < / a >
2024-01-02 16:07:41 +13:00
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
< span class = "red fe fe-report" title = "{{ _('Reported. Check comment for issues.') }}" > < / span >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-15 21:13:32 +13:00
< / div >
2024-05-30 21:54:25 +12:00
< div class = "comment_body hidable {% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user) -%}reported{% endif -%}" >
2024-03-28 03:40:42 +00:00
{{ comment['comment'].body_html | community_links | safe }}
2024-05-30 21:54:25 +12:00
< / div > {% if not comment['comment'].author.indexable -%}<!-- googleon: all --> {% endif -%}
2023-10-15 19:36:14 +13:00
< / div >
2023-12-28 20:00:07 +13:00
< div class = "comment_actions hidable" >
2024-05-30 21:54:25 +12:00
{% if post.comments_enabled -%}
2024-02-13 21:28:33 +13:00
< a href = "{{ url_for('post.add_reply', post_id=post.id, comment_id=comment['comment'].id) }}" rel = "nofollow noindex" > < span class = "fe fe-reply" > < / span > reply< / a >
2024-05-30 21:54:25 +12:00
{% endif -%}
2024-01-16 21:39:10 +13:00
< div class = "voting_buttons_new" >
2024-05-30 21:54:25 +12:00
{% with comment=comment['comment'] -%}
{% include "post/_comment_voting_buttons.html" -%}
{% endwith -%}
2024-01-16 21:39:10 +13:00
< / div >
< div class = "hide_button" >
2024-06-28 18:34:54 +08:00
{% if comment['comment'].score < = reply_collapse_threshold -%}
2024-01-16 21:39:10 +13:00
< a href = '#' > < span class = "fe fe-expand" > < / span > < / a >
2024-05-30 21:54:25 +12:00
{% else -%}
2024-01-16 21:39:10 +13:00
< a href = '#' > < span class = "fe fe-collapse" > < / span > < / a >
2024-05-30 21:54:25 +12:00
{% endif -%}
2024-01-16 21:39:10 +13:00
< / div >
2024-05-30 21:54:25 +12:00
{% if current_user.is_authenticated and current_user.verified -%}
{% include "post/_reply_notification_toggle.html" -%}
{% endif -%}
2024-02-26 21:26:19 +13:00
< a href = "{{ url_for('post.post_reply_options', post_id=post.id, comment_id=comment['comment'].id) }}" class = "comment_actions_link" rel = "nofollow noindex" aria-label = "{{ _('Comment options') }}" > < span class = "fe fe-options" title = "Options" > < / span > < / a >
2023-12-28 20:00:07 +13:00
< / div >
2024-05-30 21:54:25 +12:00
{% if comment['replies'] -%}
{% if comment['comment'].depth < = THREAD_CUTOFF_DEPTH -%}
2024-02-26 15:52:55 +13:00
< div class = "replies hidable" role = "group" >
2024-05-30 21:54:25 +12:00
{% for reply in comment['replies'] -%}
2023-10-16 21:38:36 +13:00
{{ render_comment(reply) | safe }}
2024-05-30 21:54:25 +12:00
{% endfor -%}
2023-10-16 21:38:36 +13:00
< / div >
2024-05-30 21:54:25 +12:00
{% else -%}
2023-10-16 21:38:36 +13:00
< div class = "continue_thread hidable" >
2023-11-30 06:36:08 +13:00
< a href = "{{ url_for('post.continue_discussion', post_id=post.id, comment_id=comment['comment'].id, _anchor='replies') }}" >
2023-10-16 21:38:36 +13:00
Continue thread< / a >
< / div >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% endif -%}
2023-10-10 22:25:37 +13:00
< / div >
2024-06-28 18:34:54 +08:00
{% if comment['comment'].score < = reply_collapse_threshold -%}
2023-10-23 22:54:11 +13:00
< script nonce = "{{ session['nonce'] }}" type = "text/javascript" >
toBeHidden.push({{ comment['comment'].id }});
< / script >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% endmacro -%}
2023-10-02 22:16:44 +13:00
2024-03-01 05:16:48 +13:00
< div id = "replies" class = "comments" role = "tree" aria-label = "{{ _('Comments') }}" aria-expanded = "true" >
2024-05-30 21:54:25 +12:00
{% for reply in replies -%}
2023-10-10 22:25:37 +13:00
{{ render_comment(reply) | safe }}
2024-05-30 21:54:25 +12:00
{% endfor -%}
2023-10-10 22:25:37 +13:00
< / div >
2023-10-02 22:16:44 +13:00
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-02 22:16:44 +13:00
< / div >
2024-02-05 08:39:08 +13:00
< aside id = "side_pane" class = "col-12 col-md-4 side_pane" role = "complementary" >
2023-10-02 22:16:44 +13:00
< div class = "card" >
< div class = "card-body" >
< div class = "row" >
2024-05-30 21:54:25 +12:00
{% if not community.restricted_to_mods or (community.restricted_to_mods and current_user.is_authenticated and community_membership(current_user, community) in [SUBSCRIPTION_MODERATOR, SUBSCRIPTION_OWNER]) -%}
2024-04-15 12:54:27 +01:00
< div class = "col-6" >
< a class = "w-100 btn btn-primary" href = "/community/{{ post.community.link() }}/submit" > {{ _('Create post') }}< / a >
< / div >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-02 22:16:44 +13:00
< div class = "col-6" >
2024-05-30 21:54:25 +12:00
{% if current_user.is_authenticated and community_membership(current_user, post.community) >= SUBSCRIPTION_MEMBER -%}
2024-01-16 15:38:56 +13:00
< a class = "w-100 btn btn-primary" href = "/community/{{ post.community.link() }}/unsubscribe" rel = "nofollow" > {{ _('Leave') }}< / a >
2024-05-30 21:54:25 +12:00
{% else -%}
2024-01-16 15:38:56 +13:00
< a class = "w-100 btn btn-primary" href = "/community/{{ post.community.link() }}/subscribe" rel = "nofollow" > {{ _('Join') }}< / a >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-02 22:16:44 +13:00
< / div >
< / div >
2024-05-09 20:00:22 +12:00
< form method = "get" action = "/search" >
< input type = "search" name = "q" class = "form-control mt-2" placeholder = "{{ _('Search this community') }}" / >
< input type = "hidden" name = "community" value = "{{ post.community.id }}" >
< / form >
2023-10-02 22:16:44 +13:00
< / div >
< / div >
< div class = "card mt-3" >
< div class = "card-header" >
< h2 > {{ _('About community') }}< / h2 >
< / div >
< div class = "card-body" >
2023-12-27 13:02:52 +13:00
< p > {{ post.community.description_html|safe if post.community.description_html else '' }}< / p >
< p > {{ post.community.rules_html|safe if post.community.rules_html else '' }}< / p >
2024-05-30 21:54:25 +12:00
{% if len(mods) > 0 and not post.community.private_mods -%}
2023-10-02 22:16:44 +13:00
< h3 > Moderators< / h3 >
2023-12-27 11:00:30 +13:00
< ul class = "moderator_list" >
2024-05-30 21:54:25 +12:00
{% for mod in mods -%}
2024-01-09 20:44:08 +13:00
< li > < a href = "/u/{{ mod.link() }}" > {{ mod.display_name() }}< / a > < / li >
2024-05-30 21:54:25 +12:00
{% endfor -%}
2023-12-27 11:00:30 +13:00
< / ul >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-02 22:16:44 +13:00
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% if related_communities -%}
2024-03-09 14:59:05 +13:00
< div class = "card mt-3" >
< div class = "card-header" >
< h2 > {{ _('Related communities') }}< / h2 >
< / div >
< div class = "card-body" >
< ul class = "list-group list-group-flush" >
2024-05-30 21:54:25 +12:00
{% for community in related_communities -%}
2024-03-09 14:59:05 +13:00
< li class = "list-group-item" >
2024-07-04 14:26:18 +02:00
{{ render_communityname(community) }}
2024-03-09 14:59:05 +13:00
< / li >
2024-05-30 21:54:25 +12:00
{% endfor -%}
2024-03-09 14:59:05 +13:00
< / ul >
< p class = "mt-4" > < a class = "btn btn-primary" href = "/communities" > {{ _('Explore communities') }}< / a > < / p >
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if is_moderator -%}
2023-10-02 22:16:44 +13:00
< div class = "card mt-3" >
< div class = "card-header" >
< h2 > {{ _('Community Settings') }}< / h2 >
< / div >
< div class = "card-body" >
2024-05-30 21:54:25 +12:00
{% if is_moderator or is_owner or is_admin -%}
2024-03-26 22:18:05 +13:00
< p > < a href = "/community/{{ community.link() }}/moderate" class = "btn btn-primary" > {{ _('Moderate') }}< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if is_owner or is_admin -%}
2024-03-26 22:18:05 +13:00
< p > < a href = "{{ url_for('community.community_edit', community_id=community.id) }}" class = "btn btn-primary" > {{ _('Settings') }}< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% if community.is_local() and (community.is_owner() or current_user.is_admin()) -%}
2024-03-26 22:18:05 +13:00
< p > < a class = "btn btn-primary btn-warning" href = "{{ url_for('community.community_delete', community_id=community.id) }}" rel = "nofollow" > Delete community< / a > < / p >
2024-05-30 21:54:25 +12:00
{% endif -%}
2023-10-02 22:16:44 +13:00
< / div >
< / div >
2024-05-30 21:54:25 +12:00
{% endif -%}
{% include "_inoculation_links.html" -%}
2024-01-28 21:38:04 +13:00
< / aside >
2023-10-02 22:16:44 +13:00
< / div >
2024-01-21 12:14:05 +13:00
< script nonce = "{{ session['nonce'] }}" >
window.addEventListener("load", function () {
currentPost = document.querySelector('.post_col'); // set the current post, so A and Z voting keys work when viewing a post page
});
< / script >
2024-05-30 21:54:25 +12:00
{% endblock -%}