diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-13 12:22:02 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-25 15:12:41 +0200 |
commit | 812bfb158b70b09cfd438379a4b9446aa85b52ec (patch) | |
tree | ee252f7086632223ecc483967f89d8a7b3014054 /app/models/user_status.rb | |
parent | 3f14c56bfe77e83084b58dc2bd3c34e3c84c6cae (diff) | |
download | gitlab-ce-812bfb158b70b09cfd438379a4b9446aa85b52ec.tar.gz |
Add the `UserStatus` model
This model will hold the status of a user, including these fields:
- emoji: always present, with a default value
- user: always present, foreign key to user
- message: optional, maximum length of 100
The table also stores
- cached_markdown_version
- message_html
For rendering markdown in the `message` field.
Diffstat (limited to 'app/models/user_status.rb')
-rw-r--r-- | app/models/user_status.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/user_status.rb b/app/models/user_status.rb new file mode 100644 index 00000000000..df65d89b03c --- /dev/null +++ b/app/models/user_status.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class UserStatus < ActiveRecord::Base + include CacheMarkdownField + + belongs_to :user + + 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: :single_line +end |