summaryrefslogtreecommitdiff
path: root/app/models/spam_log.rb
blob: 2ec53f58e5faeac05e427ddacf57ea3380b6d7f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class SpamLog < ApplicationRecord
  belongs_to :user

  validates :user, presence: true

  def remove_user(deleted_by:)
    user.delete_async(deleted_by: deleted_by, params: { hard_delete: true })
  end

  def text
    [title, description].join("\n")
  end

  def self.verify_recaptcha!(id:, user_id:)
    find_by(id: id, user_id: user_id)&.update!(recaptcha_verified: true)
  end
end