2018-07-13 10:22:02 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 13:17:42 +00:00
|
|
|
class UserStatus < ApplicationRecord
|
2018-07-13 10:22:02 +00:00
|
|
|
include CacheMarkdownField
|
|
|
|
|
2018-07-16 16:18:52 +00:00
|
|
|
self.primary_key = :user_id
|
|
|
|
|
|
|
|
DEFAULT_EMOJI = 'speech_balloon'.freeze
|
|
|
|
|
2018-07-13 10:22:02 +00:00
|
|
|
belongs_to :user
|
|
|
|
|
|
|
|
validates :user, presence: true
|
|
|
|
validates :emoji, inclusion: { in: Gitlab::Emoji.emojis_names }
|
|
|
|
validates :message, length: { maximum: 100 }, allow_blank: true
|
|
|
|
|
2018-07-13 15:52:31 +00:00
|
|
|
cache_markdown_field :message, pipeline: :emoji
|
2018-07-13 10:22:02 +00:00
|
|
|
end
|