changeset 8946:fdc9c2fd439a stable

repo group: fix API for updating parent With other bugs out of the way, the API implementation just has to pass the new group id correctly. Note that - as in many other places - moving things to the top level doesn't work. Original patch has been modified by Mads Kiilerich.
author toras9000 <toras9000@gmail.com>
date Sat, 10 Dec 2022 18:08:12 +0100
parents 03d51a2a395d
children abc29122c7f2
files CONTRIBUTORS kallithea/controllers/api/api.py kallithea/templates/about.html kallithea/tests/api/api_base.py
diffstat 4 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CONTRIBUTORS	Sat Dec 10 18:06:17 2022 +0100
+++ b/CONTRIBUTORS	Sat Dec 10 18:08:12 2022 +0100
@@ -2,6 +2,7 @@
 
     Mads Kiilerich <mads@kiilerich.com> 2016-2022
     Manuel Jacob <me@manueljacob.de> 2019-2020 2022
+    toras9000 <toras9000@gmail.com> 2022
     Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> 2014-2021
     ssantos <ssantos@web.de> 2018-2021
     Private <adamantine.sword@gmail.com> 2019-2021
--- a/kallithea/controllers/api/api.py	Sat Dec 10 18:06:17 2022 +0100
+++ b/kallithea/controllers/api/api.py	Sat Dec 10 18:08:12 2022 +0100
@@ -1791,13 +1791,14 @@
                           owner=None,
                           parent=None):
         repo_group = get_repo_group_or_error(repogroupid)
+        parent_repo_group_id = None if parent is None else get_repo_group_or_error(parent).group_id
 
         updates = {}
         try:
             store_update(updates, group_name, 'group_name')
             store_update(updates, description, 'group_description')
             store_update(updates, owner, 'owner')
-            store_update(updates, parent, 'parent_group')
+            store_update(updates, parent_repo_group_id, 'parent_group_id')
             repo_group = RepoGroupModel().update(repo_group, updates)
             meta.Session().commit()
             return dict(
--- a/kallithea/templates/about.html	Sat Dec 10 18:06:17 2022 +0100
+++ b/kallithea/templates/about.html	Sat Dec 10 18:08:12 2022 +0100
@@ -26,6 +26,7 @@
 
   <li>Copyright &copy; 2012&ndash;2022, Mads Kiilerich</li>
   <li>Copyright &copy; 2019&ndash;2020, 2022, Manuel Jacob</li>
+  <li>Copyright &copy; 2022, toras9000</li>
   <li>Copyright &copy; 2014&ndash;2021, Thomas De Schampheleire</li>
   <li>Copyright &copy; 2015&ndash;2017, 2019&ndash;2021, Étienne Gilli</li>
   <li>Copyright &copy; 2018&ndash;2021, ssantos</li>
--- a/kallithea/tests/api/api_base.py	Sat Dec 10 18:06:17 2022 +0100
+++ b/kallithea/tests/api/api_base.py	Sat Dec 10 18:08:12 2022 +0100
@@ -1854,7 +1854,7 @@
         #('owner', {'owner': base.TEST_USER_REGULAR_LOGIN}),  # currently broken
         ('description', {'description': 'new description'}),
         ('group_name', {'group_name': 'new_repo_name'}),
-        #('parent', {'parent': 'test_group_for_update'}),  # currently broken
+        ('parent', {'parent': 'test_group_for_update'}),
     ])
     def test_api_update_repo_group(self, changing_attr, updates):
         group_name = 'lololo'