diff --git a/frontend/src/components/discord/DiscordEmbed.tsx b/frontend/src/components/discord/DiscordEmbed.tsx index 807a6942..86979495 100644 --- a/frontend/src/components/discord/DiscordEmbed.tsx +++ b/frontend/src/components/discord/DiscordEmbed.tsx @@ -47,16 +47,19 @@ const DiscordEmbedComponent: FC = ({ embed, entities, classNa {embed.title && (
{embed.url && isSafeUrl(embed.url) ? ( - - {embed.title} + + ) : ( -

{embed.title}

+ )}
)} @@ -76,7 +79,11 @@ const DiscordEmbedComponent: FC = ({ embed, entities, classNa key={index} className={field.inline ? "inline-block mr-4 mb-2 min-w-37.5 max-w-50" : "mb-2"} > -
{field.name}
+ = ({ const linkedArticle = kbArticleId != null ? kbArticles?.find((a) => a.id === kbArticleId) : null; + const hasContentPreview = content.trim().length > 0; + const hasArticlePreview = !!linkedArticle?.content?.trim(); + const kbArticleOptions = (kbArticles ?? []) .filter((a) => a.published) .map((a) => ({ @@ -408,12 +412,13 @@ const TagEditorModal: FC = ({ {linkToKB && linkedArticle ? (

Showing linked KB article preview:

- {linkedArticle.content && ( -

- {linkedArticle.content} -

+ {hasArticlePreview && ( + )} - {!linkedArticle.content && ( + {!hasArticlePreview && (

Article has no text content (may use an embed).

@@ -421,13 +426,14 @@ const TagEditorModal: FC = ({
) : ( <> - {content && ( -

- {content} -

+ {hasContentPreview && ( + )} {useEmbed && } - {!content && !useEmbed && ( + {!hasContentPreview && !useEmbed && (

Add message content or enable an embed to see a preview.