diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index fd8622aa2..92462e30c 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -36,7 +36,8 @@ class ForumTopicsController < ApplicationController @forum_topic.mark_as_read!(CurrentUser.user) end @forum_posts = ForumPost.search(:topic_id => @forum_topic.id).reorder("forum_posts.id").paginate(params[:page]) - @forum_posts = @forum_posts.reverse_order.includes(:creator).load if request.format.atom? + @forum_posts = @forum_posts.includes(:creator, :bulk_update_request) + @forum_posts = @forum_posts.reverse_order.load if request.format.atom? respond_with(@forum_topic) end diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index 7e29a4298..af3f26e03 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -90,18 +90,12 @@ class ForumPost < ApplicationRecord end end - def tag_change_request - bulk_update_request || tag_alias || tag_implication - end - def reportable_by?(user) visible?(user) && creator_id != user.id && !creator.is_moderator? end def votable? - TagAlias.where(forum_post_id: id).exists? || - TagImplication.where(forum_post_id: id).exists? || - BulkUpdateRequest.where(forum_post_id: id).exists? + bulk_update_request.present? && bulk_update_request.is_pending? end def voted?(user, score) diff --git a/app/views/forum_post_votes/_list.html.erb b/app/views/forum_post_votes/_list.html.erb index 77db71503..d866af2d0 100644 --- a/app/views/forum_post_votes/_list.html.erb +++ b/app/views/forum_post_votes/_list.html.erb @@ -11,6 +11,6 @@ <%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %> <% end %> -<% if forum_post.tag_change_request && forum_post.tag_change_request.is_pending? && !votes.by(CurrentUser.user.id).exists? %> +<% if forum_post.votable? && !votes.by(CurrentUser.user.id).exists? %> <%= render "forum_post_votes/add_vote", vote: votes.by(CurrentUser.user.id).first, forum_post: forum_post %> <% end %> diff --git a/app/views/forum_post_votes/_vote.html.erb b/app/views/forum_post_votes/_vote.html.erb index d46d56ab3..51dc051b1 100644 --- a/app/views/forum_post_votes/_vote.html.erb +++ b/app/views/forum_post_votes/_vote.html.erb @@ -4,7 +4,7 @@ %>