You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2022/02/18 19:38:04 UTC

[allura] 01/03: Avoid extra redirect for /p/foo => /p/foo/ since the latter will do its own redir anyway

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit b438b6607ff92c7e92416652886ee45ea783c1ac
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Fri Feb 18 13:38:51 2022 -0500

    Avoid extra redirect for /p/foo => /p/foo/ since the latter will do its own redir anyway
---
 Allura/allura/controllers/project.py                      | 9 ++-------
 ForgeActivity/forgeactivity/tests/functional/test_root.py | 2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index d8593af..6de75c3 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -397,19 +397,14 @@ class ProjectController(FeedController):
         require_access(c.project, 'read')
 
     @expose()
-    @with_trailing_slash
     def index(self, **kw):
         mount, app = c.project.first_mount_visible(c.user)
-        activity_enabled = asbool(config.get('activitystream.enabled', False))
         if mount is not None:
             if hasattr(app, 'default_redirect'):
                 app.default_redirect()
-            if 'ac' in mount:
-                redirect(mount['ac'].options.mount_point + '/')
-            elif 'sub' in mount:
-                redirect(mount['sub'].url())
+            redirect(app.url() if callable(app.url) else app.url)  # Application has property; Subproject has method
         else:
-            redirect(c.project.app_configs[0].options.mount_point + '/')
+            redirect(c.project.app_configs[0].url())
 
     def get_feed(self, project, app, user):
         """Return a :class:`allura.controllers.feed.FeedArgs` object describing
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index 9963972..6b9a057 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -57,7 +57,7 @@ class TestActivityController(TestController):
     @td.with_user_project('test-user-1')
     def test_anon_read(self):
         r = self.app.get('/u/test-user-1',
-                extra_environ={'username': str('*anonymous')}).follow().follow()
+                extra_environ={'username': str('*anonymous')}).follow()
         assert r.html.select('div.profile-section.tools a[href="/u/test-user-1/activity/"]'),\
             'No Activity tool in top nav'