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-03-20 23:03:53 +0300
committerDouwe Maan <douwe@selenight.nl>2016-03-20 23:04:07 +0300
commit8db1292139cfdac4c29c03b876b68b9e752cf75a (patch)
tree2fcf67ada482ecf4ac90f39c858334a62b709618 /lib/gitlab/visibility_level.rb
parent2eb19ea3ea36916bbea72a8ccab3e6d15f602ac9 (diff)
Tweaks, refactoring, and specs
Diffstat (limited to 'lib/gitlab/visibility_level.rb')
-rw-r--r--lib/gitlab/visibility_level.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index 58cd8df5219..0a1f66b0726 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -11,6 +11,8 @@ module Gitlab
included do
scope :public_only, -> { where(visibility_level: PUBLIC) }
scope :public_and_internal_only, -> { where(visibility_level: [PUBLIC, INTERNAL] ) }
+
+ scope :public_to_user, -> (user) { user && !user.external ? public_and_internal_only : public_only }
end
PRIVATE = 0 unless const_defined?(:PRIVATE)