From 97dd235de35720725166278c48b1cf090c2b7fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 29 Apr 2023 13:55:43 +0200 Subject: [PATCH] Use note_plain on group edit page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/group/edit-group.tsx | 2 +- app/soapbox/schemas/group.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/soapbox/features/group/edit-group.tsx b/app/soapbox/features/group/edit-group.tsx index 4176f6106..184df76d5 100644 --- a/app/soapbox/features/group/edit-group.tsx +++ b/app/soapbox/features/group/edit-group.tsx @@ -44,7 +44,7 @@ const EditGroup: React.FC = ({ params: { groupId } }) => { const header = useImageField({ maxPixels: 1920 * 1080, preview: nonDefaultHeader(group?.header) }); const displayName = useTextField(group?.display_name); - const note = useTextField(group?.note); + const note = useTextField(group?.note_plain); const maxName = Number(instance.configuration.getIn(['groups', 'max_characters_name'])); const maxNote = Number(instance.configuration.getIn(['groups', 'max_characters_description'])); diff --git a/app/soapbox/schemas/group.ts b/app/soapbox/schemas/group.ts index 746ae9d33..38139ca42 100644 --- a/app/soapbox/schemas/group.ts +++ b/app/soapbox/schemas/group.ts @@ -29,6 +29,9 @@ const groupSchema = z.object({ note: z.string().transform(note => note === '

' ? '' : note).catch(''), relationship: groupRelationshipSchema.nullable().catch(null), // Dummy field to be overwritten later slug: z.string().catch(''), // TruthSocial + source: z.object({ + note: z.string(), + }).optional(), // TruthSocial statuses_visibility: z.string().catch('public'), tags: z.array(groupTagSchema).catch([]), uri: z.string().catch(''), @@ -43,10 +46,10 @@ const groupSchema = z.object({ ...group, display_name_html: emojify(escapeTextContentForBrowser(group.display_name), customEmojiMap), note_emojified: emojify(group.note, customEmojiMap), - note_plain: unescapeHTML(group.note), + note_plain: group.source?.note || unescapeHTML(group.note), }; }); type Group = z.infer; -export { groupSchema, type Group }; \ No newline at end of file +export { groupSchema, type Group };