From 27d91a629918e417a9e87825e838209b9ace79c1 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 10 Dec 2019 15:07:52 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/models/user_mention.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/models/user_mention.rb (limited to 'app/models/user_mention.rb') 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 -- cgit v1.2.3