Prevent valuation comments from appearing in public pages
This commit is contained in:
@@ -4,7 +4,8 @@ class Admin::CommentsController < Admin::BaseController
|
||||
before_action :load_comment, only: [:confirm_hide, :restore]
|
||||
|
||||
def index
|
||||
@comments = Comment.only_hidden.with_visible_author.send(@current_filter).order(hidden_at: :desc).page(params[:page])
|
||||
@comments = Comment.not_valuations.only_hidden.with_visible_author
|
||||
.send(@current_filter).order(hidden_at: :desc).page(params[:page])
|
||||
end
|
||||
|
||||
def confirm_hide
|
||||
@@ -22,7 +23,7 @@ class Admin::CommentsController < Admin::BaseController
|
||||
private
|
||||
|
||||
def load_comment
|
||||
@comment = Comment.with_hidden.find(params[:id])
|
||||
@comment = Comment.not_valuations.with_hidden.find(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
@@ -6,7 +6,7 @@ class Admin::StatsController < Admin::BaseController
|
||||
@visits = Visit.count
|
||||
@debates = Debate.with_hidden.count
|
||||
@proposals = Proposal.with_hidden.count
|
||||
@comments = Comment.with_hidden.count
|
||||
@comments = Comment.not_valuations.with_hidden.count
|
||||
|
||||
@debate_votes = Vote.where(votable_type: 'Debate').count
|
||||
@proposal_votes = Vote.where(votable_type: 'Proposal').count
|
||||
|
||||
@@ -9,7 +9,7 @@ class StatsController < ApplicationController
|
||||
@visits = daily_cache('visits') { Visit.count }
|
||||
@debates = daily_cache('debates') { Debate.with_hidden.count }
|
||||
@proposals = daily_cache('proposals') { Proposal.with_hidden.count }
|
||||
@comments = daily_cache('comments') { Comment.with_hidden.count }
|
||||
@comments = daily_cache('comments') { Comment.not_valuations.with_hidden.count }
|
||||
|
||||
@debate_votes = daily_cache('debate_votes') { Vote.where(votable_type: 'Debate').count }
|
||||
@proposal_votes = daily_cache('proposal_votes') { Vote.where(votable_type: 'Proposal').count }
|
||||
|
||||
@@ -88,7 +88,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def all_user_comments
|
||||
Comment.not_as_admin_or_moderator.where(user_id: @user.id)
|
||||
Comment.not_valuations.not_as_admin_or_moderator.where(user_id: @user.id)
|
||||
end
|
||||
|
||||
def only_active_commentables
|
||||
|
||||
@@ -368,6 +368,17 @@ feature 'Users' do
|
||||
expect(page).not_to have_content(admin_comment.body)
|
||||
end
|
||||
|
||||
scenario 'valuation comments are not visible in user activity' do
|
||||
admin = create(:administrator).user
|
||||
comment = create(:comment, user: admin)
|
||||
investment = create(:budget_investment)
|
||||
valuation_comment = create(:comment, :valuation, user: admin, commentable: investment)
|
||||
|
||||
visit user_path(admin)
|
||||
expect(page).to have_content(comment.body)
|
||||
expect(page).not_to have_content(valuation_comment.body)
|
||||
end
|
||||
|
||||
scenario 'shows only comments from active features' do
|
||||
user = create(:user)
|
||||
1.times {create(:comment, user: user, commentable: create(:debate))}
|
||||
|
||||
Reference in New Issue
Block a user