Hide archived projects from shared_projects
Since we don't show the archived projects, we shouldnot load them and pass them to the fronted to be filtered out again.
This commit is contained in:
parent
35ba75f6b9
commit
2f50b206f2
2 changed files with 13 additions and 2 deletions
|
@ -24,7 +24,9 @@ module Groups
|
||||||
# Make the `search` param consistent for the frontend,
|
# Make the `search` param consistent for the frontend,
|
||||||
# which will be using `filter`.
|
# which will be using `filter`.
|
||||||
params[:search] ||= params[:filter] if params[:filter]
|
params[:search] ||= params[:filter] if params[:filter]
|
||||||
params.permit(:sort, :search)
|
# Don't show archived projects
|
||||||
|
params[:non_archived] = true
|
||||||
|
params.permit(:sort, :search, :non_archived)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe Groups::SharedProjectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows filtering shared projects' do
|
it 'allows filtering shared projects' do
|
||||||
project = create(:project, :archived, namespace: user.namespace, name: "Searching for")
|
project = create(:project, namespace: user.namespace, name: "Searching for")
|
||||||
share_project(project)
|
share_project(project)
|
||||||
|
|
||||||
get_shared_projects(filter: 'search')
|
get_shared_projects(filter: 'search')
|
||||||
|
@ -55,5 +55,14 @@ describe Groups::SharedProjectsController do
|
||||||
|
|
||||||
expect(json_project_ids).to eq([second_project.id, shared_project.id])
|
expect(json_project_ids).to eq([second_project.id, shared_project.id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not include archived projects' do
|
||||||
|
archived_project = create(:project, :archived, namespace: user.namespace)
|
||||||
|
share_project(archived_project)
|
||||||
|
|
||||||
|
get_shared_projects
|
||||||
|
|
||||||
|
expect(json_project_ids).to contain_exactly(shared_project.id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue