Class: Email

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

Constant Summary

Constants included from Cells::Claimable

Cells::Claimable::CLAIMS_BUCKET_TYPE, Cells::Claimable::CLAIMS_SOURCE_TYPE, Cells::Claimable::CLAIMS_SUBJECT_TYPE, Cells::Claimable::MissingPrimaryKeyError

Constants included from Gitlab::SQL::Pattern

Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING, Gitlab::SQL::Pattern::REGEX_QUOTED_TERM

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Instance Method Summary collapse

Methods included from ForcedEmailConfirmation

#force_confirm

Methods included from AfterCommitQueue

#run_after_commit, #run_after_commit_or_now

Methods included from Cells::Claimable

#handle_grpc_error

Methods included from Gitlab::SQL::Pattern

split_query_to_search_terms

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, 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 Organizations::Sharding

#sharding_organization

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Instance Method Details

#email=(value) ⇒ Object



43
44
45
# File 'app/models/email.rb', line 43

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

#unique_emailObject



47
48
49
# File 'app/models/email.rb', line 47

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



52
53
54
# File 'app/models/email.rb', line 52

def update_invalid_gpg_signatures
  user.update_invalid_gpg_signatures if confirmed?
end

#user_primary_email?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'app/models/email.rb', line 56

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