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

30 lines
847 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
class UserDetail < ApplicationRecord
2020-07-28 23:09:34 +05:30
extend ::Gitlab::Utils::Override
2021-11-11 11:23:49 +05:30
include IgnorableColumns
2021-11-18 22:05:49 +05:30
ignore_columns %i[bio_html cached_markdown_version], remove_with: '14.5', remove_after: '2021-10-22'
REGISTRATION_OBJECTIVE_PAIRS = { basics: 0, move_repository: 1, code_storage: 2, exploring: 3, ci: 4, other: 5, joining_team: 6 }.freeze
2020-07-28 23:09:34 +05:30
2020-04-08 14:13:33 +05:30
belongs_to :user
2021-09-04 01:27:46 +05:30
validates :pronouns, length: { maximum: 50 }
2021-10-27 15:23:28 +05:30
validates :pronunciation, length: { maximum: 255 }
2020-04-08 14:13:33 +05:30
validates :job_title, length: { maximum: 200 }
2020-07-28 23:09:34 +05:30
validates :bio, length: { maximum: 255 }, allow_blank: true
before_save :prevent_nil_bio
2021-11-18 22:05:49 +05:30
enum registration_objective: REGISTRATION_OBJECTIVE_PAIRS, _suffix: true
2020-07-28 23:09:34 +05:30
private
def prevent_nil_bio
self.bio = '' if bio_changed? && bio.nil?
end
2020-04-08 14:13:33 +05:30
end
2021-02-22 17:27:13 +05:30
2021-06-08 01:23:25 +05:30
UserDetail.prepend_mod_with('UserDetail')