From 5a98e68f9b423360306ed05ce0855fc8748fab04 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 20 Nov 2024 09:49:19 -0600 Subject: [PATCH 1/2] Enable custom profile fields on Ditto --- src/utils/features.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/features.ts b/src/utils/features.ts index ff7b202cf..4c68928c3 100644 --- a/src/utils/features.ts +++ b/src/utils/features.ts @@ -883,6 +883,7 @@ const getInstanceFeatures = (instance: InstanceV1 | InstanceV2) => { v.software === MASTODON, v.software === PLEROMA, v.software === TAKAHE && gte(v.version, '0.7.0'), + v.software === DITTO, ]), /** From 8a09fba01e49bead5cdd2bd5fe4b52ecfcf8fd3e Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Wed, 20 Nov 2024 20:44:28 -0300 Subject: [PATCH 2/2] fix(AdminNostrRelays): refetchQueries after onSuccess, display toast success and error --- src/features/admin/nostr-relays.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/features/admin/nostr-relays.tsx b/src/features/admin/nostr-relays.tsx index 7d90c1c49..98fc17d72 100644 --- a/src/features/admin/nostr-relays.tsx +++ b/src/features/admin/nostr-relays.tsx @@ -9,11 +9,14 @@ import Form from 'soapbox/components/ui/form.tsx'; import Stack from 'soapbox/components/ui/stack.tsx'; import RelayEditor, { RelayData } from 'soapbox/features/nostr-relays/components/relay-editor.tsx'; import { useApi } from 'soapbox/hooks/useApi.ts'; +import { queryClient } from 'soapbox/queries/client.ts'; +import toast from 'soapbox/toast.tsx'; import { useAdminNostrRelays } from './hooks/useAdminNostrRelays.ts'; const messages = defineMessages({ title: { id: 'column.admin.nostr_relays', defaultMessage: 'Relays' }, + success: { id: 'generic.saved', defaultMessage: 'Saved' }, }); const AdminNostrRelays: React.FC = () => { @@ -25,6 +28,13 @@ const AdminNostrRelays: React.FC = () => { const mutation = useMutation({ mutationFn: async () => api.put('/api/v1/admin/ditto/relays', relays), + onSuccess: () => { + queryClient.refetchQueries({ queryKey: ['NostrRelay'] }); + toast.success(messages.success); + }, + onError: (data) => { + toast.error(data.message); // `data.message` is a generic error message, not the `error` message returned from the backend + }, }); const handleSubmit = () => {