summaryrefslogtreecommitdiff
path: root/app/models/custom_emoji.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-22 03:10:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-22 03:10:36 +0000
commit65da49eb0103df6d7b1401db94e5d322b6766df2 (patch)
tree4d1b3cff3a0e0c542c93526d7a6722c464ac9f20 /app/models/custom_emoji.rb
parent1b3785910ee36281a08f968e0ac1af892bb96dd0 (diff)
downloadgitlab-ce-65da49eb0103df6d7b1401db94e5d322b6766df2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/custom_emoji.rb')
-rw-r--r--app/models/custom_emoji.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/custom_emoji.rb b/app/models/custom_emoji.rb
index f4c914c6a3a..aea48a5ec20 100644
--- a/app/models/custom_emoji.rb
+++ b/app/models/custom_emoji.rb
@@ -6,6 +6,7 @@ class CustomEmoji < ApplicationRecord
belongs_to :namespace, inverse_of: :custom_emoji
belongs_to :group, -> { where(type: 'Group') }, foreign_key: 'namespace_id'
+ belongs_to :creator, class_name: "User", inverse_of: :created_custom_emoji
# For now only external emoji are supported. See https://gitlab.com/gitlab-org/gitlab/-/issues/230467
validates :external, inclusion: { in: [true] }
@@ -15,6 +16,7 @@ class CustomEmoji < ApplicationRecord
validate :valid_emoji_name
validates :group, presence: true
+ validates :creator, presence: true
validates :name,
uniqueness: { scope: [:namespace_id, :name] },
presence: true,