Skip to content
Snippets Groups Projects
Commit 3058a8fa authored by Douwe Maan's avatar Douwe Maan
Browse files

Fix "Shared projects" tab

parent fd8d44ca
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -44,7 +44,7 @@ class GroupsController < Groups::ApplicationController
@projects = @projects.sort(@sort = params[:sort])
@projects = @projects.page(params[:page]).per(PER_PAGE) if params[:filter_projects].blank?
 
@shared_projects = GroupProjectsFinder.new(group, shared: true).execute(current_user)
@shared_projects = GroupProjectsFinder.new(group, only_shared: true).execute(current_user)
 
respond_to do |format|
format.html
Loading
Loading
@@ -77,7 +77,7 @@ class GroupsController < Groups::ApplicationController
end
 
def projects
@projects = @projects.sorted_by_activity.page(params[:page])
@projects = @group.projects.page(params[:page])
end
 
def update
Loading
Loading
Loading
Loading
@@ -13,29 +13,29 @@ class GroupProjectsFinder < UnionFinder
private
 
def group_projects(current_user)
include_owned = @options.fetch(:owned, true)
include_shared = @options.fetch(:shared, true)
only_owned = @options.fetch(:only_owned, false)
only_shared = @options.fetch(:only_shared, false)
 
projects = []
 
if current_user
if @group.users.include?(current_user)
projects << @group.projects if include_owned
projects << @group.shared_projects if include_shared
projects << @group.projects unless only_shared
projects << @group.shared_projects unless only_owned
else
if include_owned
unless only_shared
projects << @group.projects.visible_to_user(current_user)
projects << @group.projects.public_to_user(current_user)
end
 
if include_shared
unless only_owned
projects << @group.shared_projects.visible_to_user(current_user)
projects << @group.shared_projects.public_to_user(current_user)
end
end
else
projects << @group.projects.public_only if include_owned
projects << @group.shared_projects.public_only if include_shared
projects << @group.projects.public_only unless only_shared
projects << @group.shared_projects.public_only unless only_owned
end
 
projects
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment