From 68d4d4142cdf62a0bb3a4e03a6bbdffd0207929c Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sat, 9 Mar 2024 12:45:26 -0800 Subject: [PATCH] Update mutewords and hiddenposts to use the new sdk --- src/components/TagMenu/index.tsx | 2 +- src/components/TagMenu/index.web.tsx | 2 +- src/components/dialogs/MutedWords.tsx | 4 +- .../moderation/ModerationDetailsDialog.tsx | 15 +- .../__tests__/moderatePost_wrapped.test.ts | 692 ------------------ src/lib/moderatePost_wrapped.ts | 385 +--------- .../useModerationCauseDescription.ts | 20 +- src/screens/Moderation/index.tsx | 27 + src/state/queries/preferences/const.ts | 4 +- src/state/queries/preferences/index.ts | 11 +- src/view/screens/DebugMod.tsx | 2 + 11 files changed, 60 insertions(+), 1104 deletions(-) delete mode 100644 src/lib/__tests__/moderatePost_wrapped.test.ts diff --git a/src/components/TagMenu/index.tsx b/src/components/TagMenu/index.tsx index 849a3f42d1..13e4e7d6b2 100644 --- a/src/components/TagMenu/index.tsx +++ b/src/components/TagMenu/index.tsx @@ -59,7 +59,7 @@ export function TagMenu({ const displayTag = '#' + tag const isMuted = Boolean( - (preferences?.mutedWords?.find( + (preferences?.moderationPrefs.mutedWords?.find( m => m.value === tag && m.targets.includes('tag'), ) ?? optimisticUpsert?.find( diff --git a/src/components/TagMenu/index.web.tsx b/src/components/TagMenu/index.web.tsx index 8245bd0191..b2f5c90756 100644 --- a/src/components/TagMenu/index.web.tsx +++ b/src/components/TagMenu/index.web.tsx @@ -50,7 +50,7 @@ export function TagMenu({ const {mutateAsync: removeMutedWord, variables: optimisticRemove} = useRemoveMutedWordMutation() const isMuted = Boolean( - (preferences?.mutedWords?.find( + (preferences?.moderationPrefs.mutedWords?.find( m => m.value === tag && m.targets.includes('tag'), ) ?? optimisticUpsert?.find( diff --git a/src/components/dialogs/MutedWords.tsx b/src/components/dialogs/MutedWords.tsx index 658ba2aae0..f9e54e8405 100644 --- a/src/components/dialogs/MutedWords.tsx +++ b/src/components/dialogs/MutedWords.tsx @@ -233,8 +233,8 @@ function MutedWordsInner({}: {control: Dialog.DialogOuterProps['control']}) { - ) : preferences.mutedWords.length ? ( - [...preferences.mutedWords] + ) : preferences.moderationPrefs.mutedWords.length ? ( + [...preferences.moderationPrefs.mutedWords] .reverse() .map((word, i) => (