topic misc bugfixes

This commit is contained in:
rimu 2024-01-28 19:19:26 +13:00
parent 6ba4a1f719
commit 74dee6651a
4 changed files with 8 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{% if current_user.is_authenticated and current_user.verified %} {% if current_user.is_authenticated and current_user.verified %}
{% if can_upvote(current_user, community) %} {% if can_upvote(current_user, community) %}
<div class="upvote_button digits_{{ digits(comment.up_votes) }} {{ upvoted_class }}" role="button" aria-label="{{ _('UpVote') }}" <div class="upvote_button {{ upvoted_class }}" role="button" aria-label="{{ _('UpVote') }}"
hx-post="/comment/{{ comment.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0"> hx-post="/comment/{{ comment.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
<span class="fe fe-arrow-up"></span> <span class="fe fe-arrow-up"></span>
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;"> <img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">
@ -8,7 +8,7 @@
{% endif %} {% endif %}
<span title="{{ comment.up_votes }}, {{ comment.down_votes }}">{{ comment.up_votes - comment.down_votes }}</span> <span title="{{ comment.up_votes }}, {{ comment.down_votes }}">{{ comment.up_votes - comment.down_votes }}</span>
{% if can_downvote(current_user, community) %} {% if can_downvote(current_user, community) %}
<div class="downvote_button digits_{{ digits(comment.down_votes) }} {{ downvoted_class }}" role="button" aria-label="{{ _('DownVote') }}" <div class="downvote_button {{ downvoted_class }}" role="button" aria-label="{{ _('DownVote') }}"
hx-post="/comment/{{ comment.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0"> hx-post="/comment/{{ comment.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
<span class="fe fe-arrow-down"></span> <span class="fe fe-arrow-down"></span>
<img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;"> <img class="htmx-indicator" src="/static/images/spinner.svg" alt="" style="opacity: 0;">

View file

@ -2,7 +2,7 @@
{% if content_blocked and content_blocked == '-1' %} {% if content_blocked and content_blocked == '-1' %}
{# do nothing - blocked by keyword filter #} {# do nothing - blocked by keyword filter #}
{% else %} {% else %}
<div class="post_teaser{{ ' reported' if post.reports and current_user.is_authenticated and post.community.is_moderator() }}{{ ' blocked' if content_blocked }}" <div class="post_teaser type_{{ post.type }}{{ ' reported' if post.reports and current_user.is_authenticated and post.community.is_moderator() }}{{ ' blocked' if content_blocked }}"
{% if content_blocked %} title="{{ _('Filtered: ') }}{{ content_blocked }}"{% endif %}> {% if content_blocked %} title="{{ _('Filtered: ') }}{{ content_blocked }}"{% endif %}>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">

View file

@ -1,6 +1,6 @@
{% if current_user.is_authenticated and current_user.verified %} {% if current_user.is_authenticated and current_user.verified %}
{% if can_upvote(current_user, post.community) %} {% if can_upvote(current_user, post.community) %}
<div class="upvote_button digits_{{ digits(post.up_votes) }} {{ upvoted_class }}" role="button" aria-label="{{ _('UpVote') }}" <div class="upvote_button {{ upvoted_class }}" role="button" aria-label="{{ _('UpVote') }}"
hx-post="/post/{{ post.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons" tabindex="0"> hx-post="/post/{{ post.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons" tabindex="0">
<span class="fe fe-arrow-up"></span> <span class="fe fe-arrow-up"></span>
{{ shorten_number(post.up_votes) }} {{ shorten_number(post.up_votes) }}
@ -8,7 +8,7 @@
</div> </div>
{% endif %} {% endif %}
{% if can_downvote(current_user, post.community) %} {% if can_downvote(current_user, post.community) %}
<div class="downvote_button digits_{{ digits(post.down_votes) }} {{ downvoted_class }}" role="button" aria-label="{{ _('DownVote') }}" <div class="downvote_button {{ downvoted_class }}" role="button" aria-label="{{ _('DownVote') }}"
hx-post="/post/{{ post.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons" tabindex="0"> hx-post="/post/{{ post.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons" tabindex="0">
<span class="fe fe-arrow-down"></span> <span class="fe fe-arrow-down"></span>
{{ shorten_number(post.down_votes) }} {{ shorten_number(post.down_votes) }}

View file

@ -7,7 +7,7 @@ from flask_babel import _
from sqlalchemy import text, desc from sqlalchemy import text, desc
from app.activitypub.signature import post_request from app.activitypub.signature import post_request
from app.constants import SUBSCRIPTION_NONMEMBER from app.constants import SUBSCRIPTION_NONMEMBER, POST_TYPE_IMAGE, POST_TYPE_LINK
from app.inoculation import inoculation from app.inoculation import inoculation
from app.models import Topic, Community, Post, utcnow, CommunityMember, CommunityJoinRequest from app.models import Topic, Community, Post, utcnow, CommunityMember, CommunityJoinRequest
from app.topic import bp from app.topic import bp
@ -65,7 +65,8 @@ def show_topic(topic_name):
topic_communities=topic_communities, content_filters=content_filters, topic_communities=topic_communities, content_filters=content_filters,
show_post_community=True, moderating_communities=moderating_communities(current_user.get_id()), show_post_community=True, moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()),
inoculation=inoculation[randint(0, len(inoculation) - 1)]) inoculation=inoculation[randint(0, len(inoculation) - 1)],
POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE)
else: else:
abort(404) abort(404)