Small block user refactor

This commit is contained in:
Carlos Iniesta
2019-10-13 21:55:12 +02:00
committed by Javi Martín
parent 5538a1346b
commit 712d33ef99

View File

@@ -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)