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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1ced11479 make it easier to change order of sidebar items w/ the 
AdminExtension
1ced11479 is described below

commit 1ced1147925c5b90edb507c3aa81d04d13375374
Author: Dillon Walls <dillon.wa...@slashdotmedia.com>
AuthorDate: Wed Mar 6 16:24:01 2024 +0000

    make it easier to change order of sidebar items w/ the AdminExtension
---
 Allura/allura/ext/admin/admin_main.py | 2 +-
 Allura/allura/lib/plugin.py           | 8 ++++++--
 ForgeImporters/forgeimporters/base.py | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Allura/allura/ext/admin/admin_main.py 
b/Allura/allura/ext/admin/admin_main.py
index 6e8232fc6..d250a70fe 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -172,7 +172,7 @@ class AdminApp(Application):
 
         for ep_name in sorted(g.entry_points['admin'].keys()):
             admin_extension = g.entry_points['admin'][ep_name]
-            admin_extension().update_project_sidebar_menu(links)
+            links = (admin_extension().update_project_sidebar_menu(links) or 
links)
 
         return links
 
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index d88163284..3bb389d15 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -33,6 +33,7 @@ from random import randint
 from hashlib import sha256
 from base64 import b64encode
 from datetime import datetime, timedelta
+import typing
 import calendar
 import six
 
@@ -60,6 +61,9 @@ from allura.lib import utils
 from allura.tasks import activity_tasks
 from allura.tasks.index_tasks import solr_del_project_artifacts
 
+if typing.TYPE_CHECKING:
+    from allura.app import SitemapEntry
+
 log = logging.getLogger(__name__)
 
 
@@ -1800,7 +1804,7 @@ class AdminExtension:
 
     project_admin_controllers = {}
 
-    def update_project_sidebar_menu(self, sidebar_links):
+    def update_project_sidebar_menu(self, sidebar_links: list['SitemapEntry']) 
-> list['SitemapEntry']:
         """
         Implement this function to modify the project sidebar.
         Check `c.project` if you want to limit when this displays
@@ -1811,7 +1815,7 @@ class AdminExtension:
 
         :rtype: ``None``
         """
-        pass
+        return sidebar_links
 
 
 class SiteAdminExtension:
diff --git a/ForgeImporters/forgeimporters/base.py 
b/ForgeImporters/forgeimporters/base.py
index bd07200c5..e66cce270 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -611,6 +611,7 @@ class ImportAdminExtension(AdminExtension):
         base_url = c.project.url() + 'admin/ext/'
         link = SitemapEntry('Import', base_url + 'import/')
         sidebar_links.append(link)
+        return sidebar_links
 
 
 def bytesio_parser(page):

Reply via email to