# HG changeset patch # User toras9000 # Date 2022-12-10 18:08:12 # Node ID fdc9c2fd439ae7c73c7f4021aa9084273499675d # Parent 03d51a2a395dd40c1f29c4e7be5fb4dfcd81b75f 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. diff --git a/CONTRIBUTORS b/CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,6 +2,7 @@ List of contributors to Kallithea projec Mads Kiilerich 2016-2022 Manuel Jacob 2019-2020 2022 + toras9000 2022 Thomas De Schampheleire 2014-2021 ssantos 2018-2021 Private 2019-2021 diff --git a/kallithea/controllers/api/api.py b/kallithea/controllers/api/api.py --- a/kallithea/controllers/api/api.py +++ b/kallithea/controllers/api/api.py @@ -1791,13 +1791,14 @@ class ApiController(JSONRPCController): 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( diff --git a/kallithea/templates/about.html b/kallithea/templates/about.html --- a/kallithea/templates/about.html +++ b/kallithea/templates/about.html @@ -26,6 +26,7 @@
  • Copyright © 2012–2022, Mads Kiilerich
  • Copyright © 2019–2020, 2022, Manuel Jacob
  • +
  • Copyright © 2022, toras9000
  • Copyright © 2014–2021, Thomas De Schampheleire
  • Copyright © 2015–2017, 2019–2021, Étienne Gilli
  • Copyright © 2018–2021, ssantos
  • diff --git a/kallithea/tests/api/api_base.py b/kallithea/tests/api/api_base.py --- a/kallithea/tests/api/api_base.py +++ b/kallithea/tests/api/api_base.py @@ -1854,7 +1854,7 @@ class _BaseTestApi(object): #('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'