From c1ca34303e5d81e011b0c993f34e20c6d20d8c5a Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Mon, 20 Mar 2023 10:30:41 +1100 Subject: [PATCH] Fix incorrect performer data being sent and submitted when multiple stash-box endpoints configured (#3543) * Show performer stash id for selected instance * Fix incorrect select value in SubmitDraft modal --- .../src/components/Dialogs/SubmitDraft.tsx | 1 + .../Tagger/performers/PerformerTagger.tsx | 110 +++++++++--------- 2 files changed, 56 insertions(+), 55 deletions(-) diff --git a/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx b/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx index f00e4b213..7c0364f8d 100644 --- a/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx +++ b/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx @@ -96,6 +96,7 @@ export const SubmitStashBoxDraft: React.FC = ({ {boxes.map((box, i) => ( diff --git a/ui/v2.5/src/components/Tagger/performers/PerformerTagger.tsx b/ui/v2.5/src/components/Tagger/performers/PerformerTagger.tsx index 97c3b329f..1436d5059 100755 --- a/ui/v2.5/src/components/Tagger/performers/PerformerTagger.tsx +++ b/ui/v2.5/src/components/Tagger/performers/PerformerTagger.tsx @@ -379,10 +379,13 @@ const PerformerTaggerList: React.FC = ({ const renderPerformers = () => performers.map((performer) => { const isTagged = taggedPerformers[performer.id]; - const hasStashIDs = performer.stash_ids.length > 0; + + const stashID = performer.stash_ids.find((s) => { + return s.endpoint === selectedEndpoint.endpoint; + }); let mainContent; - if (!isTagged && hasStashIDs) { + if (!isTagged && stashID !== undefined) { mainContent = (
@@ -390,7 +393,7 @@ const PerformerTaggerList: React.FC = ({
); - } else if (!isTagged && !hasStashIDs) { + } else if (!isTagged && !stashID) { mainContent = ( = ({ } let subContent; - if (performer.stash_ids.length > 0) { - const stashLinks = performer.stash_ids.map((stashID) => { - const base = stashID.endpoint.match(/https?:\/\/.*?\//)?.[0]; - const link = base ? ( - - {stashID.stash_id} - - ) : ( -
{stashID.stash_id}
- ); + if (stashID !== undefined) { + const base = stashID.endpoint.match(/https?:\/\/.*?\//)?.[0]; + const link = base ? ( + + {stashID.stash_id} + + ) : ( +
{stashID.stash_id}
+ ); - const endpoint = - stashBoxes?.findIndex((box) => box.endpoint === stashID.endpoint) ?? - -1; + const endpointIndex = + stashBoxes?.findIndex((box) => box.endpoint === stashID.endpoint) ?? + -1; - return ( -
- - {link} - - {endpoint !== -1 && ( - - )} - - - {error[performer.id] && ( -
- - Error: - {error[performer.id]?.message} - -
{error[performer.id]?.details}
-
- )} -
- ); - }); - subContent = <>{stashLinks}; + subContent = ( +
+ + {link} + + {endpointIndex !== -1 && ( + + )} + + + {error[performer.id] && ( +
+ + Error: + {error[performer.id]?.message} + +
{error[performer.id]?.details}
+
+ )} +
+ ); } else if (searchErrors[performer.id]) { subContent = (