You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/09/05 20:21:00 UTC

[35/50] git commit: [#4595] ticket:421 Filter out deleted projects

[#4595] ticket:421 Filter out deleted projects


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f59fcc24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f59fcc24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f59fcc24

Branch: refs/heads/cj/6596
Commit: f59fcc246dedaeae060cf63532507dfdec473840
Parents: 8b15df9
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Aug 30 12:17:20 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/site_admin.py         |  6 ++++--
 .../templates/site_admin_new_projects.html      |  2 --
 .../allura/tests/functional/test_site_admin.py  | 20 +++++++++++++++++---
 3 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 50b0e38..7595d66 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -189,8 +189,10 @@ class SiteAdminController(object):
         limit, pagenum, start = g.handle_paging(limit, page, default=100)
         count = 0
         nb = M.Neighborhood.query.get(name='Users')
-        projects = (M.Project.query.find({'neighborhood_id': {'$ne': nb._id}})
-                                   .sort('_id', -1))
+        projects = (M.Project.query.find({
+                'neighborhood_id': {'$ne': nb._id},
+                'deleted': False,
+            }).sort('_id', -1))
         count = projects.count()
         projects = projects.skip(start).limit(limit)
         return {

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index aae9e48..bd97dc1 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -30,7 +30,6 @@
         <th>Name</th>
         <th>Short description</th>
         <th>Summary</th>
-        <th>Deleted?</th>
         <th>Homepage</th>
         <th>Admins</th>
       </tr>
@@ -47,7 +46,6 @@
       <td><small><a href="{{ p.url() }}">{{ p.name }}</a></small></td>
       <td><small>{{ p.short_description }}</small></td>
       <td><small>{{ p.summary }}</small></td>
-      <td><small>{{ 'Yes' if p.deleted else 'No' }}</small></td>
       <td><small>{{ p.external_homepage|urlize(22) }}</small></td>
       <td><small>{{ p.admins()|join(' ') }}</small></td>
     </tr>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index dc8f26c..e339ff7 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -17,6 +17,9 @@
 
 import json
 
+from nose.tools import assert_equal
+from ming.odm import ThreadLocalORMSession
+
 from allura import model as M
 from allura.tests import TestController
 from allura.lib.decorators import task
@@ -60,9 +63,20 @@ class TestSiteAdmin(TestController):
         assert headers[3].contents[0] == 'Name'
         assert headers[4].contents[0] == 'Short description'
         assert headers[5].contents[0] == 'Summary'
-        assert headers[6].contents[0] == 'Deleted?'
-        assert headers[7].contents[0] == 'Homepage'
-        assert headers[8].contents[0] == 'Admins'
+        assert headers[6].contents[0] == 'Homepage'
+        assert headers[7].contents[0] == 'Admins'
+
+    def test_new_projects_deleted_projects(self):
+        '''Deleted projects should not be visible here'''
+        r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+                username='root'))
+        count = len(r.html.find('table').findAll('tr'))
+        p = M.Project.query.get(shortname='test')
+        p.deleted = True
+        ThreadLocalORMSession.flush_all()
+        r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+                username='root'))
+        assert_equal(len(r.html.find('table').findAll('tr')), count - 1)
 
     def test_reclone_repo_access(self):
         r = self.app.get('/nf/admin/reclone_repo', extra_environ=dict(