debian-mirror-gitlab/app/models/issue_email_participant.rb
2023-03-04 22:38:38 +05:30

15 lines
438 B
Ruby

# 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