mirror of
https://github.com/stashapp/stash.git
synced 2025-12-07 17:02:38 +01:00
Clean duplicate aliases when creating from performer tagger (#4801)
* Clean duplicate aliases when creating from performer tagger * Use case insensitive name matching
This commit is contained in:
parent
0bba8889b8
commit
22d14fd89e
1 changed files with 19 additions and 0 deletions
|
|
@ -18,6 +18,21 @@ interface IStashSearchResultProps {
|
||||||
excludedPerformerFields: string[];
|
excludedPerformerFields: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #4596 - remove any duplicate aliases or aliases that are the same as the performer's name
|
||||||
|
function cleanAliases(currentName: string, aliases: string[]) {
|
||||||
|
const ret: string[] = [];
|
||||||
|
aliases.forEach((alias) => {
|
||||||
|
if (
|
||||||
|
alias.toLowerCase() !== currentName.toLowerCase() &&
|
||||||
|
!ret.find((r) => r.toLowerCase() === alias.toLowerCase())
|
||||||
|
) {
|
||||||
|
ret.push(alias);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
||||||
performer,
|
performer,
|
||||||
stashboxPerformers,
|
stashboxPerformers,
|
||||||
|
|
@ -43,6 +58,10 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
||||||
input.stash_ids = mergeStashIDs(performer.stash_ids, input.stash_ids);
|
input.stash_ids = mergeStashIDs(performer.stash_ids, input.stash_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.alias_list) {
|
||||||
|
input.alias_list = cleanAliases(performer.name, input.alias_list);
|
||||||
|
}
|
||||||
|
|
||||||
const updateData: GQL.PerformerUpdateInput = {
|
const updateData: GQL.PerformerUpdateInput = {
|
||||||
...input,
|
...input,
|
||||||
id: performer.id,
|
id: performer.id,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue