Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user_mention.rb')
-rw-r--r--app/models/user_mention.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/models/user_mention.rb b/app/models/user_mention.rb
new file mode 100644
index 00000000000..a85c6168cea
--- /dev/null
+++ b/app/models/user_mention.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class UserMention < ApplicationRecord
+ self.abstract_class = true
+
+ def has_mentions?
+ mentioned_users_ids.present? || mentioned_groups_ids.present? || mentioned_projects_ids.present?
+ end
+
+ private
+
+ def mentioned_users
+ User.where(id: mentioned_users_ids)
+ end
+
+ def mentioned_groups
+ Group.where(id: mentioned_groups_ids)
+ end
+
+ def mentioned_projects
+ Project.where(id: mentioned_projects_ids)
+ end
+end