mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
make disable_voting work again - user profiles
This commit is contained in:
parent
375235435e
commit
d7b750f9b9
5 changed files with 15 additions and 22 deletions
|
@ -1,5 +1,6 @@
|
|||
{% if current_user.is_authenticated and current_user.verified %}
|
||||
{% if can_upvote(current_user, community) %}
|
||||
{% if disable_voting %} {% endif %}
|
||||
{% if can_upvote(current_user, community) and not disable_voting %}
|
||||
<div class="upvote_button {{ 'voted_up' if in_sorted_list(recently_upvoted_replies, comment.id) }}" role="button" aria-label="{{ _('UpVote button.') }}" aria-live="assertive"
|
||||
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>
|
||||
|
@ -7,7 +8,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<span title="{{ comment.up_votes }}, {{ comment.down_votes }}" aria-live="assertive" aria-label="{{ _('Score: ') }}{{ 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) and not disable_voting %}
|
||||
<div class="downvote_button {{ 'voted_down' if in_sorted_list(recently_downvoted_replies, comment.id) }}" role="button" aria-label="{{ _('DownVote button.') }}" aria-live="assertive"
|
||||
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>
|
||||
|
|
|
@ -46,36 +46,30 @@
|
|||
{{ post_reply.body_html | community_links | safe }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row comment_actions hidable">
|
||||
<div class="col-auto">
|
||||
<div class="comment_actions hidable">
|
||||
{% if post_reply.post.comments_enabled -%}
|
||||
<a href="{{ url_for('post.add_reply', post_id=post_reply.post.id, comment_id=post_reply.id) }}" class="" rel="nofollow noindex"><span class="fe fe-reply"></span> reply</a>
|
||||
{% endif -%}
|
||||
<div class="voting_buttons_new">
|
||||
{% with comment=post_reply, community=post_reply.post.community -%}
|
||||
{% include "post/_comment_voting_buttons.html" -%}
|
||||
{% endwith -%}
|
||||
</div>
|
||||
<div class="col-auto voting_buttons_new">
|
||||
{% if not disable_voting -%}
|
||||
{% with comment=post_reply, community=post_reply.post.community -%}
|
||||
{% include "post/_comment_voting_buttons.html" -%}
|
||||
{% endwith -%}
|
||||
{% endif -%}
|
||||
</div>
|
||||
<div class="col-auto hide_button">
|
||||
<div class="hide_button">
|
||||
{% if collapsed -%}
|
||||
<a href='#' class=""><span class="fe fe-expand"></span></a>
|
||||
{% else -%}
|
||||
<a href='#' class=""><span class="fe fe-collapse"></span></a>
|
||||
{% endif -%}
|
||||
</div>
|
||||
<div class="col-auto ms-auto">
|
||||
<div class="notify_toggle">
|
||||
{% if current_user.is_authenticated -%}
|
||||
{% with comment=dict(comment=post_reply) -%}
|
||||
{% include "post/_reply_notification_toggle.html" -%}
|
||||
{% endwith -%}
|
||||
{% endif -%}
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<a href="{{ url_for('post.post_reply_options', post_id=post_reply.post.id, comment_id=post_reply.id) }}" class="" rel="nofollow noindex" aria-label="{{ _('Comment options') }}"><span class="fe fe-options" title="Options"> </span></a>
|
||||
</div>
|
||||
<a href="{{ url_for('post.post_reply_options', post_id=post_reply.post.id, comment_id=post_reply.id) }}" class="comment_actions_link" rel="nofollow noindex" aria-label="{{ _('Comment options') }}"><span class="fe fe-options" title="Options"> </span></a>
|
||||
</div>
|
||||
{% if not post_reply.author.indexable -%}<!--googleon all-->{% endif -%}
|
||||
{% if collapsed -%}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% if current_user.is_authenticated and current_user.verified -%}
|
||||
{% if can_upvote(current_user, post.community) -%}
|
||||
{% if can_upvote(current_user, post.community) and not disable_voting -%}
|
||||
<div class="upvote_button {{ 'voted_up' if in_sorted_list(recently_upvoted, post.id) }}" role="button" aria-label="{{ _('UpVote button, %(count)d upvotes so far.', count=post.up_votes) }}" aria-live="assertive"
|
||||
hx-post="/post/{{ post.id }}/upvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
|
||||
<span class="fe fe-arrow-up"></span>
|
||||
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
{% endif -%}
|
||||
<span title="{{ post.up_votes }}, {{ post.down_votes }}" aria-live="assertive" aria-label="{{ _('Score: ') }}{{ post.up_votes - post.down_votes }}.">{{ shorten_number(post.up_votes - post.down_votes) }}</span>
|
||||
{% if can_downvote(current_user, post.community) -%}
|
||||
{% if can_downvote(current_user, post.community) and not disable_voting -%}
|
||||
<div class="downvote_button {{ 'voted_down' if in_sorted_list(recently_downvoted, post.id) }}" role="button" aria-label="{{ _('DownVote button, %(count)d downvotes so far.', count=post.down_votes) }}" aria-live="assertive"
|
||||
hx-post="/post/{{ post.id }}/downvote" hx-trigger="click throttle:1s" hx-target="closest .voting_buttons_new" tabindex="0">
|
||||
<span class="fe fe-arrow-down"></span>
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
<h2 class="mt-4" id="comments">Comments</h2>
|
||||
<div class="post_list">
|
||||
{% for post_reply in post_replies.items %}
|
||||
{% with teaser=True, disable_voting=not current_user.is_authenticated or (current_user.id != post_reply.author.id) %}
|
||||
{% with teaser=True %}
|
||||
{% include 'post/_post_reply_teaser.html' %}
|
||||
{% endwith %}
|
||||
<hr />
|
||||
|
|
|
@ -86,9 +86,7 @@ def show_profile(user):
|
|||
return render_template('user/show_profile.html', user=user, posts=posts, post_replies=post_replies,
|
||||
moderates=moderates.all(), canonical=canonical, title=_('Posts by %(user_name)s',
|
||||
user_name=user.user_name),
|
||||
POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_VIDEO=POST_TYPE_VIDEO,
|
||||
POST_TYPE_POLL=POST_TYPE_POLL,
|
||||
description=description, subscribed=subscribed, upvoted=upvoted,
|
||||
description=description, subscribed=subscribed, upvoted=upvoted, disable_voting=True,
|
||||
post_next_url=post_next_url, post_prev_url=post_prev_url,
|
||||
replies_next_url=replies_next_url, replies_prev_url=replies_prev_url,
|
||||
noindex=not user.indexable, show_post_community=True, hide_vote_buttons=True,
|
||||
|
|
Loading…
Add table
Reference in a new issue