diff --git a/app/post/routes.py b/app/post/routes.py index c1e5f832..4e7ae603 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -31,7 +31,8 @@ from app.utils import get_setting, render_template, allowlist_html, markdown_to_ reply_already_exists, reply_is_just_link_to_gif_reaction, confidence, moderating_communities, joined_communities, \ blocked_instances, blocked_domains, community_moderators, blocked_phrases, show_ban_message, recently_upvoted_posts, \ recently_downvoted_posts, recently_upvoted_post_replies, recently_downvoted_post_replies, reply_is_stupid, \ - languages_for_form, menu_topics, add_to_modlog, blocked_communities, piefed_markdown_to_lemmy_markdown + languages_for_form, menu_topics, add_to_modlog, blocked_communities, piefed_markdown_to_lemmy_markdown, \ + permission_required def show_post(post_id: int): @@ -1791,10 +1792,9 @@ def post_cross_posts(post_id: int): @bp.route('/post//voting_activity', methods=['GET']) @login_required +@permission_required('change instance settings') def post_view_voting_activity(post_id: int): post = Post.query.get_or_404(post_id) - if not current_user.is_admin() and not post.community.is_moderator() and not post.community.is_owner(): - abort(404) post_title=post.title upvoters = User.query.join(PostVote, PostVote.user_id == User.id).filter_by(post_id=post_id, effect=1.0).order_by(User.ap_domain, User.user_name) @@ -1812,10 +1812,9 @@ def post_view_voting_activity(post_id: int): @bp.route('/comment//voting_activity', methods=['GET']) @login_required +@permission_required('change instance settings') def post_reply_view_voting_activity(comment_id: int): post_reply = PostReply.query.get_or_404(comment_id) - if not current_user.is_admin() and not post_reply.community.is_moderator() and not post_reply.community.is_owner(): - abort(404) reply_text=post_reply.body upvoters = User.query.join(PostReplyVote, PostReplyVote.user_id == User.id).filter_by(post_reply_id=comment_id, effect=1.0).order_by(User.ap_domain, User.user_name) diff --git a/app/templates/post/post_options.html b/app/templates/post/post_options.html index 27c378da..3ca3dc3f 100644 --- a/app/templates/post/post_options.html +++ b/app/templates/post/post_options.html @@ -62,7 +62,7 @@ {% endif -%}
  • {{ _('Report to moderators') }}
  • - {% if current_user.is_authenticated and (post.community.is_moderator() or post.community.is_owner() or current_user.is_admin()) -%} + {% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%}
  • {{ _('View Voting Activity') }}
  • {% endif -%} diff --git a/app/templates/post/post_reply_options.html b/app/templates/post/post_reply_options.html index 666b9680..78bb7f36 100644 --- a/app/templates/post/post_reply_options.html +++ b/app/templates/post/post_reply_options.html @@ -41,7 +41,7 @@ {{ _("Hide every post from author's instance: %(name)s", name=post_reply.instance.domain) }} {% endif -%} {% endif -%} - {% if current_user.is_authenticated and (post_reply.community.is_moderator() or post_reply.community.is_owner() or current_user.is_admin()) -%} + {% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%}
  • {{ _('View Voting Activity') }}
  • {% endif -%}