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:
authorDouwe Maan <douwe@selenight.nl>2016-08-04 01:32:00 +0300
committerDouwe Maan <douwe@selenight.nl>2016-08-04 01:32:00 +0300
commit538e66d71c0f7125cc62ea51480668ba8b342544 (patch)
treed27f667dbe404ce406e2ac6b3a901b87ff93da47 /app/models/ability.rb
parent3ccb27c0c79ef92585a901de32339948319cf068 (diff)
parent8890376f0f72f713a7530bd7989e71442c69dc91 (diff)
Merge branch 'master' into diff-line-comment-vuejs
# Conflicts: # app/models/discussion.rb # db/schema.rb
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r--app/models/ability.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 5075076c27b..c9d4c4dd03b 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -47,6 +47,16 @@ class Ability
end
end
+ # Returns an Array of Issues that can be read by the given user.
+ #
+ # issues - The issues to reduce down to those readable by the user.
+ # user - The User for which to check the issues
+ def issues_readable_by_user(issues, user = nil)
+ return issues if user && user.admin?
+
+ issues.select { |issue| issue.visible_to_user?(user) }
+ end
+
# List of possible abilities for anonymous user
def anonymous_abilities(user, subject)
if subject.is_a?(PersonalSnippet)