Method: Decidim::ModerationTools#hide!

Defined in:
decidim-core/lib/decidim/moderation_tools.rb

#hide!Object

Public: hides the resources



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'decidim-core/lib/decidim/moderation_tools.rb', line 96

def hide!
  Decidim.traceability.perform_action_without_log!(current_user) do
    @reportable.moderation.update!(hidden_at: Time.current)
    @reportable.try(:touch)
  end

  if @reportable.is_a?(Decidim::Comments::Commentable)
    @reportable.comment_threads.each do |comment|
      Decidim::HideChildResourcesJob.perform_later(comment, current_user.id)
    end
  end

  send_notification_to_author
end