Class: Email

Inherits:
ApplicationRecord show all
Includes:
AsyncDeviseEmail, ForcedEmailConfirmation, Gitlab::SQL::Pattern, Sortable
Defined in:
app/models/email.rb

Constant Summary

Constants included from Gitlab::SQL::Pattern

Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING, Gitlab::SQL::Pattern::REGEX_QUOTED_WORD

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Instance Method Summary collapse

Methods included from ForcedEmailConfirmation

#force_confirm

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Instance Method Details

#email=(value) ⇒ Object


28
29
30
# File 'app/models/email.rb', line 28

def email=(value)
  write_attribute(:email, value.downcase.strip)
end

#unique_emailObject


32
33
34
# File 'app/models/email.rb', line 32

def unique_email
  self.errors.add(:email, 'has already been taken') if primary_email_of_another_user?
end

#update_invalid_gpg_signaturesObject

once email is confirmed, update the gpg signatures


37
38
39
# File 'app/models/email.rb', line 37

def update_invalid_gpg_signatures
  user.update_invalid_gpg_signatures if confirmed?
end

#user_primary_email?Boolean

Returns:

  • (Boolean)

41
42
43
# File 'app/models/email.rb', line 41

def user_primary_email?
  email.casecmp?(user.email)
end