2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
class UserStatus < ApplicationRecord
|
2018-11-18 11:00:15 +05:30
|
|
|
include CacheMarkdownField
|
|
|
|
|
|
|
|
self.primary_key = :user_id
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
DEFAULT_EMOJI = 'speech_balloon'
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
belongs_to :user
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
enum availability: { not_set: 0, busy: 1 }
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
validates :user, presence: true
|
|
|
|
validates :emoji, inclusion: { in: Gitlab::Emoji.emojis_names }
|
|
|
|
validates :message, length: { maximum: 100 }, allow_blank: true
|
|
|
|
|
|
|
|
cache_markdown_field :message, pipeline: :emoji
|
|
|
|
end
|