2019-04-03 17:33:43 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Abuse is a report made by a visitor (not especially a logged user) who has signaled a content that seems abusive to his eyes.
|
|
|
|
# It is currently used with projects.
|
2016-03-23 18:39:41 +01:00
|
|
|
class Abuse < ActiveRecord::Base
|
|
|
|
include NotifyWith::NotificationAttachedObject
|
|
|
|
|
|
|
|
belongs_to :signaled, polymorphic: true
|
|
|
|
|
|
|
|
after_create :notify_admins_abuse_reported
|
|
|
|
|
2018-12-03 15:10:04 +01:00
|
|
|
validates :first_name, :last_name, :email, :message, presence: true
|
2016-04-06 14:58:53 +02:00
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
private
|
2018-12-03 15:10:04 +01:00
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
def notify_admins_abuse_reported
|
|
|
|
NotificationCenter.call type: 'notify_admin_abuse_reported',
|
|
|
|
receiver: User.admins,
|
|
|
|
attached_object: self
|
|
|
|
end
|
|
|
|
end
|