From 712d33ef99bbdc74f13595857231bf8a2d8c1cd7 Mon Sep 17 00:00:00 2001 From: Carlos Iniesta Date: Sun, 13 Oct 2019 21:55:12 +0200 Subject: [PATCH] Small block user refactor --- app/models/user.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index f20db4bea..5df382438 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -241,19 +241,13 @@ class User < ApplicationRecord end def block - debates_ids = Debate.where(author_id: id).pluck(:id) - comments_ids = Comment.where(user_id: id).pluck(:id) - proposal_ids = Proposal.where(author_id: id).pluck(:id) - investment_ids = Budget::Investment.where(author_id: id).pluck(:id) - proposal_notification_ids = ProposalNotification.where(author_id: id).pluck(:id) - hide - Debate.hide_all debates_ids - Comment.hide_all comments_ids + Debate.hide_all debate_ids + Comment.hide_all comment_ids Proposal.hide_all proposal_ids - Budget::Investment.hide_all investment_ids - ProposalNotification.hide_all proposal_notification_ids + Budget::Investment.hide_all budget_investment_ids + ProposalNotification.hide_all ProposalNotification.where(author_id: id).pluck(:id) end def erase(erase_reason = nil)