Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issue_email_participant.rb « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dd963bc9e7e2ea8d6bb57e2edd4814df54e5749b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

class IssueEmailParticipant < ApplicationRecord
  include BulkInsertSafe

  belongs_to :issue

  validates :email, uniqueness: { scope: [:issue_id], case_sensitive: false }
  validates :issue, presence: true
  validate :validate_email_format

  def validate_email_format
    self.errors.add(:email, I18n.t(:invalid, scope: 'valid_email.validations.email')) unless ValidateEmail.valid?(self.email)
  end
end