diff --git a/packages/pl-api/lib/entities/marker.ts b/packages/pl-api/lib/entities/marker.ts index 2983ffdb1..b4b355c79 100644 --- a/packages/pl-api/lib/entities/marker.ts +++ b/packages/pl-api/lib/entities/marker.ts @@ -2,10 +2,10 @@ import { z } from 'zod'; import { dateSchema } from './utils'; -const markerSchema = z.preprocess((marker: any) => ({ +const markerSchema = z.preprocess((marker: any) => marker ? ({ unread_count: marker.pleroma?.unread_count, ...marker, -}), z.object({ +}) : null, z.object({ last_read_id: z.string(), version: z.number().int(), updated_at: dateSchema, diff --git a/packages/pl-api/lib/entities/streaming-event.ts b/packages/pl-api/lib/entities/streaming-event.ts index 917f4a6d1..970290c46 100644 --- a/packages/pl-api/lib/entities/streaming-event.ts +++ b/packages/pl-api/lib/entities/streaming-event.ts @@ -4,7 +4,7 @@ import { announcementSchema } from './announcement'; import { announcementReactionSchema } from './announcement-reaction'; import { chatSchema } from './chat'; import { conversationSchema } from './conversation'; -import { markerSchema } from './marker'; +import { markersSchema } from './marker'; import { notificationSchema } from './notification'; import { statusSchema } from './status'; @@ -82,7 +82,7 @@ const respondStreamingEventSchema = baseStreamingEventSchema.extend({ const markerStreamingEventSchema = baseStreamingEventSchema.extend({ event: z.literal('marker'), - payload: z.preprocess((payload: any) => JSON.parse(payload), markerSchema), + payload: z.preprocess((payload: any) => JSON.parse(payload), markersSchema), }); /** @see {@link https://docs.joinmastodon.org/methods/streaming/#events} */ diff --git a/packages/pl-fe/src/components/ui/streamfield/streamfield.tsx b/packages/pl-fe/src/components/ui/streamfield/streamfield.tsx index 89abed8be..1345d33bb 100644 --- a/packages/pl-fe/src/components/ui/streamfield/streamfield.tsx +++ b/packages/pl-fe/src/components/ui/streamfield/streamfield.tsx @@ -14,6 +14,7 @@ const messages = defineMessages({ /** Type of the inner Streamfield input component. */ type StreamfieldComponent = React.ComponentType<{ + index: number; value: T; onChange: (value: T) => void; autoFocus: boolean; @@ -70,9 +71,10 @@ const Streamfield: React.FC = ({ {(values.length > 0) && ( {values.map((value, i) => value?._destroy ? null : ( - + 0} diff --git a/packages/pl-fe/src/features/edit-profile/index.tsx b/packages/pl-fe/src/features/edit-profile/index.tsx index eb8ba0dde..434fadfe9 100644 --- a/packages/pl-fe/src/features/edit-profile/index.tsx +++ b/packages/pl-fe/src/features/edit-profile/index.tsx @@ -46,6 +46,7 @@ const messages = defineMessages({ header: { id: 'edit_profile.header', defaultMessage: 'Edit profile' }, metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' }, metaFieldContent: { id: 'edit_profile.fields.meta_fields.content_placeholder', defaultMessage: 'Content' }, + firstMetaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder.first', defaultMessage: 'Label (e.g. pronouns)' }, success: { id: 'edit_profile.success', defaultMessage: 'Your profile has been successfully saved!' }, error: { id: 'edit_profile.error', defaultMessage: 'Profile update failed' }, bioPlaceholder: { id: 'edit_profile.fields.bio_placeholder', defaultMessage: 'Tell us about yourself.' }, @@ -142,7 +143,7 @@ const accountToCredentials = (account: Account): AccountCredentials => { }; }; -const ProfileField: StreamfieldComponent = ({ value, onChange }) => { +const ProfileField: StreamfieldComponent = ({ index, value, onChange }) => { const intl = useIntl(); const handleChange = (key: string): React.ChangeEventHandler => e => { @@ -156,7 +157,7 @@ const ProfileField: StreamfieldComponent = ({ value, on outerClassName='w-2/5 grow' value={value.name} onChange={handleChange('name')} - placeholder={intl.formatMessage(messages.metaFieldLabel)} + placeholder={index === 0 ? intl.formatMessage(messages.firstMetaFieldLabel) : intl.formatMessage(messages.metaFieldLabel)} />