debian-mirror-gitlab/app/models/issue_email_participant.rb

17 lines
460 B
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
class IssueEmailParticipant < ApplicationRecord
2023-03-04 22:38:38 +05:30
include BulkInsertSafe
2023-04-23 21:23:45 +05:30
include Presentable
2023-03-04 22:38:38 +05:30
2021-01-03 14:25:43 +05:30
belongs_to :issue
2021-04-17 20:07:23 +05:30
validates :email, uniqueness: { scope: [:issue_id], case_sensitive: false }
2021-01-03 14:25:43 +05:30
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