Use note_plain on group edit page

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2023-04-29 13:55:43 +02:00
parent fbb258c387
commit 97dd235de3
2 changed files with 6 additions and 3 deletions

View file

@ -44,7 +44,7 @@ const EditGroup: React.FC<IEditGroup> = ({ 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']));

View file

@ -29,6 +29,9 @@ const groupSchema = z.object({
note: z.string().transform(note => note === '<p></p>' ? '' : 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<typeof groupSchema>;
export { groupSchema, type Group };
export { groupSchema, type Group };