Use UUID rather than group_id for links in gr-admin-group-list
Change-Id: I4fa08c151e6d66bce62d5c414c7b55642ce80337
This commit is contained in:
@@ -54,7 +54,7 @@ limitations under the License.
|
||||
<template is="dom-repeat" items="[[_shownGroups]]">
|
||||
<tr class="table">
|
||||
<td class="name">
|
||||
<a href$="[[_computeGroupUrl(item.group_id)]]">[[item.name]]</a>
|
||||
<a href$="[[_computeGroupUrl(item.id)]]">[[item.name]]</a>
|
||||
</td>
|
||||
<td class="description">[[item.description]]</td>
|
||||
<td class="visibleToAll">[[_visibleToAll(item)]]</td>
|
||||
|
||||
@@ -97,8 +97,13 @@
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates groups link (/admin/groups/<uuid>)
|
||||
*
|
||||
* @param {string} id
|
||||
*/
|
||||
_computeGroupUrl(id) {
|
||||
return Gerrit.Nav.getUrlForGroup(id);
|
||||
return Gerrit.Nav.getUrlForGroup(decodeURIComponent(id));
|
||||
},
|
||||
|
||||
_getCreateGroupCapability() {
|
||||
|
||||
@@ -69,6 +69,30 @@ limitations under the License.
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
test('_computeGroupUrl', () => {
|
||||
let urlStub = sandbox.stub(Gerrit.Nav, 'getUrlForGroup',
|
||||
() => '/admin/groups/e2cd66f88a2db4d391ac068a92d987effbe872f5');
|
||||
|
||||
let group = {
|
||||
id: 'e2cd66f88a2db4d391ac068a92d987effbe872f5',
|
||||
};
|
||||
assert.equal(element._computeGroupUrl(group),
|
||||
'/admin/groups/e2cd66f88a2db4d391ac068a92d987effbe872f5');
|
||||
|
||||
urlStub.restore();
|
||||
|
||||
urlStub = sandbox.stub(Gerrit.Nav, 'getUrlForGroup',
|
||||
() => '/admin/groups/user/test');
|
||||
|
||||
group = {
|
||||
id: 'user%2Ftest',
|
||||
};
|
||||
assert.equal(element._computeGroupUrl(group),
|
||||
'/admin/groups/user/test');
|
||||
|
||||
urlStub.restore();
|
||||
});
|
||||
|
||||
suite('list with groups', () => {
|
||||
setup(done => {
|
||||
groups = _.times(26, groupGenerator);
|
||||
|
||||
@@ -93,21 +93,30 @@ limitations under the License.
|
||||
});
|
||||
|
||||
test('_computeGroupPath', () => {
|
||||
sandbox.stub(Gerrit.Nav, 'getUrlForGroup',
|
||||
let urlStub = sandbox.stub(Gerrit.Nav, 'getUrlForGroup',
|
||||
() => '/admin/groups/e2cd66f88a2db4d391ac068a92d987effbe872f5');
|
||||
|
||||
let group = {
|
||||
id: 'e2cd66f88a2db4d391ac068a92d987effbe872f5',
|
||||
};
|
||||
|
||||
assert.equal(element._computeGroupPath(group),
|
||||
'/admin/groups/e2cd66f88a2db4d391ac068a92d987effbe872f5');
|
||||
|
||||
group = {
|
||||
name: 'admin',
|
||||
};
|
||||
|
||||
assert.isUndefined(element._computeGroupPath(group));
|
||||
|
||||
urlStub.restore();
|
||||
|
||||
urlStub = sandbox.stub(Gerrit.Nav, 'getUrlForGroup',
|
||||
() => '/admin/groups/user/test');
|
||||
|
||||
group = {
|
||||
id: 'user%2Ftest',
|
||||
};
|
||||
assert.equal(element._computeGroupPath(group),
|
||||
'/admin/groups/user/test');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user