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/work_item.rb')
-rw-r--r--app/models/work_item.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/work_item.rb b/app/models/work_item.rb
index adf424a1d94..73156b2f040 100644
--- a/app/models/work_item.rb
+++ b/app/models/work_item.rb
@@ -22,6 +22,18 @@ class WorkItem < Issue
foreign_key: :work_item_id, source: :work_item
scope :inc_relations_for_permission_check, -> { includes(:author, project: :project_feature) }
+ scope :in_namespaces, ->(namespaces) { where(namespace: namespaces) }
+
+ scope :with_confidentiality_check, ->(user) {
+ confidential_query = <<~SQL
+ issues.confidential = FALSE
+ OR (issues.confidential = TRUE
+ AND (issues.author_id = :user_id
+ OR EXISTS (SELECT TRUE FROM issue_assignees WHERE user_id = :user_id AND issue_id = issues.id)))
+ SQL
+
+ where(confidential_query, user_id: user.id)
+ }
class << self
def assignee_association_name
@@ -59,6 +71,11 @@ class WorkItem < Issue
includes(:parent_link).order(keyset_order)
end
+
+ override :related_link_class
+ def related_link_class
+ WorkItems::RelatedWorkItemLink
+ end
end
def noteable_target_type_name