Changeset - fdc9c2fd439a
[Not reviewed]
stable
0 4 0
toras9000 - 3 years ago 2022-12-10 18:08:12
toras9000@gmail.com
Grafted from: 6d5005f6e521
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.
4 files changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
CONTRIBUTORS
Show inline comments
 
List of contributors to Kallithea project:
 

	
 
    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
 
    Étienne Gilli <etienne@gilli.io> 2020-2021
 
    fresh <fresh190@protonmail.com> 2020-2021
 
    robertus <robertuss12@gmail.com> 2020-2021
 
    Eugenia Russell <eugenia.russell2019@gmail.com> 2021
 
    Michalis <michalisntovas@yahoo.gr> 2021
 
    vs <vsuhachev@yandex.ru> 2021
 
    Александр <akonn7@mail.ru> 2021
 
    Asterios Dimitriou <steve@pci.gr> 2016-2017 2020
 
    Allan Nordhøy <epost@anotheragency.no> 2017-2020
kallithea/controllers/api/api.py
Show inline comments
 
@@ -1782,31 +1782,32 @@ class ApiController(JSONRPCController):
 
            )
 
        except Exception:
 

	
 
            log.error(traceback.format_exc())
 
            raise JSONRPCError('failed to create repo group `%s`' % (group_name,))
 

	
 
    @HasPermissionAnyDecorator('hg.admin')
 
    def update_repo_group(self, repogroupid, group_name=None,
 
                          description=None,
 
                          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(
 
                msg='updated repository group ID:%s %s' % (repo_group.group_id,
 
                                                           repo_group.group_name),
 
                repo_group=repo_group.get_api_data()
 
            )
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            raise JSONRPCError('failed to update repository group `%s`'
 
                               % (repogroupid,))
 

	
kallithea/templates/about.html
Show inline comments
 
@@ -17,24 +17,25 @@
 
  <p><a href="https://kallithea-scm.org/">Kallithea</a> is a project of the
 
  <a href="http://sfconservancy.org/">Software Freedom Conservancy, Inc.</a>
 
  and is released under the terms of the
 
  <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License,
 
  v 3.0 (GPLv3)</a>.</p>
 

	
 
  <p>Kallithea is copyrighted by various authors, including but not
 
  necessarily limited to the following:</p>
 
  <ul>
 

	
 
  <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>
 
  <li>Copyright &copy; 2019&ndash;2021, Private</li>
 
  <li>Copyright &copy; 2020&ndash;2021, fresh</li>
 
  <li>Copyright &copy; 2020&ndash;2021, robertus</li>
 
  <li>Copyright &copy; 2021, Eugenia Russell</li>
 
  <li>Copyright &copy; 2021, Michalis</li>
 
  <li>Copyright &copy; 2021, vs</li>
 
  <li>Copyright &copy; 2021, Александр</li>
 
  <li>Copyright &copy; 2016&ndash;2017, 2020, Asterios Dimitriou</li>
 
  <li>Copyright &copy; 2017&ndash;2020, Allan Nordhøy</li>
kallithea/tests/api/api_base.py
Show inline comments
 
@@ -1845,25 +1845,25 @@ class _BaseTestApi(object):
 
                                  usergroupid=TEST_USER_GROUP, )
 
        response = api_call(self, params)
 

	
 
        expected = 'failed to edit permission for user group: `%s` in repo: `%s`' % (
 
            TEST_USER_GROUP, self.REPO
 
        )
 
        self._compare_error(id_, expected, given=response.body)
 

	
 
    @base.parametrize('changing_attr,updates', [
 
        #('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'
 
        repo_group = fixture.create_repo_group(group_name)
 

	
 
        new_group_name = group_name
 
        if changing_attr == 'group_name':
 
            assert repo_group.parent_group_id is None  # lazy assumption for this test
 
            new_group_name = updates['group_name']
 
        if changing_attr == 'parent':
 
            new_group_name = '/'.join([updates['parent'], group_name.rsplit('/', 1)[-1]])
 

	
0 comments (0 inline, 0 general)