2020-03-03 09:07:54 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class UserDetail < ApplicationRecord
|
2020-07-10 00:09:13 +00:00
|
|
|
extend ::Gitlab::Utils::Override
|
2022-06-08 09:09:42 +00:00
|
|
|
include IgnorableColumns
|
|
|
|
|
|
|
|
ignore_columns :other_role, remove_after: '2022-07-22', remove_with: '15.3'
|
2020-07-10 00:09:13 +00:00
|
|
|
|
2021-09-28 15:11:30 +00:00
|
|
|
REGISTRATION_OBJECTIVE_PAIRS = { basics: 0, move_repository: 1, code_storage: 2, exploring: 3, ci: 4, other: 5, joining_team: 6 }.freeze
|
|
|
|
|
2020-03-03 09:07:54 +00:00
|
|
|
belongs_to :user
|
|
|
|
|
2021-06-07 21:10:00 +00:00
|
|
|
validates :pronouns, length: { maximum: 50 }
|
2021-08-04 06:09:49 +00:00
|
|
|
validates :pronunciation, length: { maximum: 255 }
|
2020-03-04 21:07:54 +00:00
|
|
|
validates :job_title, length: { maximum: 200 }
|
2020-07-10 00:09:13 +00:00
|
|
|
validates :bio, length: { maximum: 255 }, allow_blank: true
|
|
|
|
|
2020-07-13 12:09:18 +00:00
|
|
|
before_save :prevent_nil_bio
|
|
|
|
|
2021-09-28 15:11:30 +00:00
|
|
|
enum registration_objective: REGISTRATION_OBJECTIVE_PAIRS, _suffix: true
|
|
|
|
|
2020-07-13 12:09:18 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def prevent_nil_bio
|
|
|
|
self.bio = '' if bio_changed? && bio.nil?
|
|
|
|
end
|
2020-03-03 09:07:54 +00:00
|
|
|
end
|
2020-12-03 18:10:10 +00:00
|
|
|
|
2021-05-11 21:10:21 +00:00
|
|
|
UserDetail.prepend_mod_with('UserDetail')
|