gitlab-org--gitlab-foss/app/models/issue_email_participant.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
412 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class IssueEmailParticipant < ApplicationRecord
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