From 0804ef9bc97fb7a8609ca4b5aec52c478302e430 Mon Sep 17 00:00:00 2001 From: "D. Ror." Date: Tue, 27 Aug 2024 12:43:57 -0400 Subject: [PATCH 1/2] Update Turnstile site key (#3331) --- deploy/scripts/setup_files/profiles/prod.yaml | 2 +- deploy/scripts/setup_files/profiles/staging.yaml | 2 +- src/types/runtimeConfig.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/scripts/setup_files/profiles/prod.yaml b/deploy/scripts/setup_files/profiles/prod.yaml index f293e076d6..e6922ea637 100644 --- a/deploy/scripts/setup_files/profiles/prod.yaml +++ b/deploy/scripts/setup_files/profiles/prod.yaml @@ -14,7 +14,7 @@ charts: # Frontend configuration items: frontend: configAnalyticsWriteKey: "j9EeK4oURluRSIKbaXCBKBxGCnT2WahB" - configCaptchaSiteKey: "0x4AAAAAAAe9zmM2ysXGSJk1" # Turnstile site key + configCaptchaSiteKey: "0x4AAAAAAAiMciPlBW1aA1iL" # Turnstile site key configShowCertExpiration: false # Maintenance configuration items maintenance: diff --git a/deploy/scripts/setup_files/profiles/staging.yaml b/deploy/scripts/setup_files/profiles/staging.yaml index 0243891114..59f38264e8 100644 --- a/deploy/scripts/setup_files/profiles/staging.yaml +++ b/deploy/scripts/setup_files/profiles/staging.yaml @@ -10,7 +10,7 @@ charts: # Frontend configuration items: frontend: configAnalyticsWriteKey: "AoebaDJNjSlOMRUH87EaNjvwkQpfLoyy" - configCaptchaSiteKey: "0x4AAAAAAAe9zmM2ysXGSJk1" # Turnstile site key + configCaptchaSiteKey: "0x4AAAAAAAiMciPlBW1aA1iL" # Turnstile site key configShowCertExpiration: false global: awsS3Location: prod.thecombine.app diff --git a/src/types/runtimeConfig.ts b/src/types/runtimeConfig.ts index 27369c2b6e..ec17c2b26d 100644 --- a/src/types/runtimeConfig.ts +++ b/src/types/runtimeConfig.ts @@ -17,7 +17,7 @@ declare global { const defaultConfig: RuntimeConfigItems = { baseUrl: "http://localhost:5000", captchaRequired: true, - captchaSiteKey: "0x4AAAAAAAe9zmM2ysXGSJk1", + captchaSiteKey: "0x4AAAAAAAiMciPlBW1aA1iL", offline: false, emailServicesEnabled: true, showCertExpiration: true, From 34b59b5d2491582e5113c5682c9daad3568c5eba Mon Sep 17 00:00:00 2001 From: "D. Ror." Date: Wed, 28 Aug 2024 09:01:42 -0400 Subject: [PATCH 2/2] [MergeDups] Show merge result when combining senses (#3324) --- .../MergeDupsStep/SenseCardContent.tsx | 28 +++++------ .../MergeDuplicates/Redux/reducerUtilities.ts | 46 +++++++++++++++---- 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/goals/MergeDuplicates/MergeDupsStep/SenseCardContent.tsx b/src/goals/MergeDuplicates/MergeDupsStep/SenseCardContent.tsx index 255684ab80..252e431053 100644 --- a/src/goals/MergeDuplicates/MergeDupsStep/SenseCardContent.tsx +++ b/src/goals/MergeDuplicates/MergeDupsStep/SenseCardContent.tsx @@ -14,6 +14,7 @@ import { IconButtonWithTooltip, PartOfSpeechButton } from "components/Buttons"; import MultilineTooltipTitle from "components/MultilineTooltipTitle"; import DomainChipsGrid from "components/WordCard/DomainChipsGrid"; import SenseCardText from "components/WordCard/SenseCardText"; +import { combineSenses } from "goals/MergeDuplicates/Redux/reducerUtilities"; interface SenseCardContentProps { senses: Sense[]; @@ -31,13 +32,14 @@ export default function SenseCardContent( ): ReactElement { const { t } = useTranslation(); - const gramInfo = props.senses - .map((s) => s.grammaticalInfo) - .find((g) => g.catGroup !== GramCatGroup.Unspecified); - - const semDoms = props.senses - .flatMap((s) => s.semanticDomains) - .sort((a, b) => a.id.localeCompare(b.id)); + const sense = combineSenses(props.senses); + const gramInfo = + sense.grammaticalInfo.catGroup === GramCatGroup.Unspecified + ? undefined + : sense.grammaticalInfo; + const semDoms = sense.semanticDomains.sort((a, b) => + a.id.localeCompare(b.id) + ); const reasonText = (reason: ProtectReason): string => { // Backend/Helper/LiftHelper.cs > GetProtectedReasons(LiftSense sense) @@ -96,9 +98,9 @@ export default function SenseCardContent( }; const protectedWarning = - !props.sidebar && props.senses[0].accessibility === Status.Protected; + !props.sidebar && sense.accessibility === Status.Protected; const tooltipTexts = [t("mergeDups.helpText.protectedSense")]; - const reasons = props.senses[0]?.protectReasons; + const reasons = sense.protectReasons; if (reasons?.length) { tooltipTexts.push( t("mergeDups.helpText.protectedData", { @@ -114,7 +116,7 @@ export default function SenseCardContent(
{gramInfo && ( @@ -128,7 +130,7 @@ export default function SenseCardContent( side="top" size="small" text={} - buttonId={`sense-${props.senses[0].guid}-protected`} + buttonId={`sense-${sense.guid}-protected`} /> )}
@@ -144,7 +146,7 @@ export default function SenseCardContent( {props.senses.length > 1 && ( @@ -152,7 +154,7 @@ export default function SenseCardContent( )} {/* List glosses and (if any) definitions. */} - + {/* List semantic domains. */} diff --git a/src/goals/MergeDuplicates/Redux/reducerUtilities.ts b/src/goals/MergeDuplicates/Redux/reducerUtilities.ts index d85627d902..719d20c74f 100644 --- a/src/goals/MergeDuplicates/Redux/reducerUtilities.ts +++ b/src/goals/MergeDuplicates/Redux/reducerUtilities.ts @@ -12,6 +12,7 @@ import { } from "goals/MergeDuplicates/MergeDupsTreeTypes"; import { newMergeWords } from "goals/MergeDuplicates/MergeDupsTypes"; import { type Hash } from "types/hash"; +import { newGrammaticalInfo, newSense } from "types/word"; import { compareFlags } from "utilities/wordUtilities"; // A collection of helper/utility functions only for use in the MergeDupsReducer. @@ -112,15 +113,42 @@ export function createMergeParent( export function combineIntoFirstSense(mergeSenses: MergeTreeSense[]): void { // Set the main sense to the first sense (the top one when the sidebar was opened). const mainSense = mergeSenses[0].sense; - const sep = "; "; + const senses: Sense[] = [mainSense]; - // Merge the rest as duplicates. + // Mark the rest as duplicates. // These were senses dropped into another sense. mergeSenses.slice(1).forEach((mergeDupSense) => { - const dupSense = mergeDupSense.sense; - dupSense.accessibility = Status.Duplicate; + mergeDupSense.sense.accessibility = Status.Duplicate; + senses.push(mergeDupSense.sense); + }); + + // Combine the sense content and update the main sense. + const combinedSense = combineSenses(senses); + mainSense.definitions = combinedSense.definitions; + mainSense.glosses = combinedSense.glosses; + mainSense.grammaticalInfo = combinedSense.grammaticalInfo; + mainSense.semanticDomains = combinedSense.semanticDomains; +} + +/** Create a copy of the first sense with the following content merged from all senses: + * definitions, glosses, grammaticalInfo, semanticDomains. */ +export function combineSenses(senses: Sense[]): Sense { + if (!senses.length) { + return newSense(); + } - // Merge the duplicate's definitions into the main sense. + const mainSense: Sense = { + ...senses[0], + definitions: [], + glosses: [], + grammaticalInfo: newGrammaticalInfo(), + semanticDomains: [], + }; + + const sep = "; "; + + senses.forEach((dupSense) => { + // Merge in the definitions. dupSense.definitions.forEach((def) => { const newText = def.text.trim(); if (newText) { @@ -143,7 +171,7 @@ export function combineIntoFirstSense(mergeSenses: MergeTreeSense[]): void { } }); - // Merge the duplicate's glosses into the main sense. + // Merge in the glosses. dupSense.glosses.forEach((gloss) => { const newDef = gloss.def.trim(); if (newDef) { @@ -166,7 +194,7 @@ export function combineIntoFirstSense(mergeSenses: MergeTreeSense[]): void { } }); - // Use the duplicate's part of speech if not specified in the main sense. + // Use the grammatical info if not already specified. if (mainSense.grammaticalInfo.catGroup === GramCatGroup.Unspecified) { mainSense.grammaticalInfo = { ...dupSense.grammaticalInfo }; } else if ( @@ -180,11 +208,13 @@ export function combineIntoFirstSense(mergeSenses: MergeTreeSense[]): void { } } - // Put the duplicate's domains in the main sense if the id is new. + // Merge in the semantic domains. dupSense.semanticDomains.forEach((dom) => { if (mainSense.semanticDomains.every((d) => d.id !== dom.id)) { mainSense.semanticDomains.push({ ...dom }); } }); }); + + return mainSense; }