mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-04-29 10:06:57 +00:00
merge: Fix: Emoji categories with subfolders, but no emoji, erroneously duplicate the subfolder's emoji (!860)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/860 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
b2ed14e1f5
1 changed files with 3 additions and 1 deletions
|
@ -186,11 +186,13 @@ function parseAndMergeCategories(input: string, root: CustomEmojiFolderTree): Cu
|
||||||
const parts = input.split('/').map(p => p.trim());
|
const parts = input.split('/').map(p => p.trim());
|
||||||
let currentNode: CustomEmojiFolderTree = root;
|
let currentNode: CustomEmojiFolderTree = root;
|
||||||
|
|
||||||
|
const currentPath = [];
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
|
currentPath.push(part);
|
||||||
let existingNode = currentNode.children.find((node) => node.value === part);
|
let existingNode = currentNode.children.find((node) => node.value === part);
|
||||||
|
|
||||||
if (!existingNode) {
|
if (!existingNode) {
|
||||||
const newNode: CustomEmojiFolderTree = { value: part, category: input, children: [] };
|
const newNode: CustomEmojiFolderTree = { value: part, category: currentPath.join("/"), children: [] };
|
||||||
currentNode.children.push(newNode);
|
currentNode.children.push(newNode);
|
||||||
existingNode = newNode;
|
existingNode = newNode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue