summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-07-26 08:29:38 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-07-26 08:29:38 +0000
commitf2da36f19661353cd1bd6788fbdf1a65e2d70f8d (patch)
treea258b53b7c3866a4994d8d416369465919f467e9
parent695f5085a1ff4be571540c3201e26060b46ec522 (diff)
parent22d53f06076e52165af3ba04d0b703bed20cfb97 (diff)
downloadgitlab-ce-f2da36f19661353cd1bd6788fbdf1a65e2d70f8d.tar.gz
Merge branch '35453-pending-delete-projects-error-in-admin-dashboard-fix' into 'master'
Fixes 500 error caused by pending delete projects in admin dashboard Closes #35453 See merge request !13067
-rw-r--r--app/controllers/admin/dashboard_controller.rb2
-rw-r--r--changelogs/unreleased/35453-pending-delete-projects-error-in-admin-dashboard-fix.yml4
-rw-r--r--spec/controllers/admin/dashboard_controller_spec.rb21
3 files changed, 26 insertions, 1 deletions
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb
index 8360ce08bdc..05e749c00c0 100644
--- a/app/controllers/admin/dashboard_controller.rb
+++ b/app/controllers/admin/dashboard_controller.rb
@@ -1,6 +1,6 @@
class Admin::DashboardController < Admin::ApplicationController
def index
- @projects = Project.with_route.limit(10)
+ @projects = Project.without_deleted.with_route.limit(10)
@users = User.limit(10)
@groups = Group.with_route.limit(10)
end
diff --git a/changelogs/unreleased/35453-pending-delete-projects-error-in-admin-dashboard-fix.yml b/changelogs/unreleased/35453-pending-delete-projects-error-in-admin-dashboard-fix.yml
new file mode 100644
index 00000000000..fa906accbb8
--- /dev/null
+++ b/changelogs/unreleased/35453-pending-delete-projects-error-in-admin-dashboard-fix.yml
@@ -0,0 +1,4 @@
+---
+title: Fixes 500 error caused by pending delete projects in admin dashboard
+merge_request: 13067
+author:
diff --git a/spec/controllers/admin/dashboard_controller_spec.rb b/spec/controllers/admin/dashboard_controller_spec.rb
new file mode 100644
index 00000000000..6eb9f7867d5
--- /dev/null
+++ b/spec/controllers/admin/dashboard_controller_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe Admin::DashboardController do
+ describe '#index' do
+ context 'with pending_delete projects' do
+ render_views
+
+ it 'does not retrieve projects that are pending deletion' do
+ sign_in(create(:admin))
+
+ project = create(:project)
+ pending_delete_project = create(:project, pending_delete: true)
+
+ get :index
+
+ expect(response.body).to match(project.name)
+ expect(response.body).not_to match(pending_delete_project.name)
+ end
+ end
+ end
+end