debian-mirror-gitlab/app/models/issue_email_participant.rb
2023-04-23 21:23:45 +05:30

16 lines
460 B
Ruby

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