Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
Excluding duplicated names from result (#572)
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Liu <[email protected]>
  • Loading branch information
fboucquez and rg911 authored Feb 9, 2021
1 parent 61e8f99 commit badeeb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rest/src/plugins/namespace/namespaceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const namespaceUtils = {
aliasName += `.${uniqueTransactions.find(t => t.namespaceId.equals(n.namespace.level1)).name}`;
if (3 <= n.namespace.depth)
aliasName += `.${uniqueTransactions.find(t => t.namespaceId.equals(n.namespace.level2)).name}`;
names.push(aliasName);
if (-1 === names.indexOf(aliasName))
names.push(aliasName);
});
return { [aliasFieldName]: id, names };
});
Expand Down
2 changes: 2 additions & 0 deletions rest/test/plugins/namespace/namespaceUtils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe('namespace utils', () => {
});
const registerNamespaceTransactionsFromNamespaceIdsFake = sinon.fake(() => {
const transactions = [
createRegisterNamespaceTransaction(12345, 1, 1, 'a'),
createRegisterNamespaceTransaction(33437, 1, 1, 'a'),
createRegisterNamespaceTransaction(12345, 1, 1, 'a'),
createRegisterNamespaceTransaction(67891, 1, 1, 'b'),
createRegisterNamespaceTransaction(38467, 1, 1, 'c'),
Expand Down

0 comments on commit badeeb1

Please sign in to comment.