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/finders/contributed_projects_finder.rb')
-rw-r--r--app/finders/contributed_projects_finder.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/finders/contributed_projects_finder.rb b/app/finders/contributed_projects_finder.rb
index a351d30229e..eccc7d3f2bb 100644
--- a/app/finders/contributed_projects_finder.rb
+++ b/app/finders/contributed_projects_finder.rb
@@ -11,12 +11,15 @@ class ContributedProjectsFinder < UnionFinder
# current_user - When given the list of the projects is limited to those only
# visible by this user.
#
+ # ignore_visibility - When true the list of projects will include all contributed
+ # projects, regardless of their visibility to the current_user
+ #
# Returns an ActiveRecord::Relation.
- def execute(current_user = nil)
+ def execute(current_user = nil, ignore_visibility: false)
# Do not show contributed projects if the user profile is private.
return Project.none unless can_read_profile?(current_user)
- segments = all_projects(current_user)
+ segments = all_projects(current_user, ignore_visibility)
find_union(segments, Project).with_namespace.order_id_desc
end
@@ -27,7 +30,9 @@ class ContributedProjectsFinder < UnionFinder
Ability.allowed?(current_user, :read_user_profile, @user)
end
- def all_projects(current_user)
+ def all_projects(current_user, ignore_visibility)
+ return [@user.contributed_projects] if ignore_visibility
+
projects = []
projects << @user.contributed_projects.visible_to_user(current_user) if current_user