2018-07-13 06:22:02 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 09:17:42 -04:00
|
|
|
class UserStatus < ApplicationRecord
|
2018-07-13 06:22:02 -04:00
|
|
|
include CacheMarkdownField
|
|
|
|
|
2018-07-16 12:18:52 -04:00
|
|
|
self.primary_key = :user_id
|
|
|
|
|
2019-08-31 15:57:00 -04:00
|
|
|
DEFAULT_EMOJI = 'speech_balloon'
|
2018-07-16 12:18:52 -04:00
|
|
|
|
2018-07-13 06:22:02 -04:00
|
|
|
belongs_to :user
|
|
|
|
|
2020-10-29 14:09:11 -04:00
|
|
|
enum availability: { not_set: 0, busy: 1 }
|
|
|
|
|
2018-07-13 06:22:02 -04:00
|
|
|
validates :user, presence: true
|
|
|
|
validates :emoji, inclusion: { in: Gitlab::Emoji.emojis_names }
|
|
|
|
validates :message, length: { maximum: 100 }, allow_blank: true
|
|
|
|
|
2018-07-13 11:52:31 -04:00
|
|
|
cache_markdown_field :message, pipeline: :emoji
|
2018-07-13 06:22:02 -04:00
|
|
|
end
|