diff --git a/components/status/StatusPreviewCard.vue b/components/status/StatusPreviewCard.vue index d8629d78..3a57569f 100644 --- a/components/status/StatusPreviewCard.vue +++ b/components/status/StatusPreviewCard.vue @@ -24,7 +24,9 @@ const providerName = $computed(() => props.card.providerName ? props.card.provid const gitHubCards = $(useFeatureFlag('experimentalGitHubCards')) // checks if title contains a username -const isMastodonLink = props.card.title.match(/@+[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/gi) +const usernames = props.card.title.match(/@+[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/gi) +const isMastodonLink = usernames?.length === 1 && props.card.type === 'link' +const username = isMastodonLink ? usernames[0] : '' // TODO: handle card.type: 'photo' | 'video' | 'rich'; const cardTypeIconMap: Record = { diff --git a/components/status/StatusPreviewMastodon.vue b/components/status/StatusPreviewMastodon.vue index 1f5b14b7..ef3c1ba0 100644 --- a/components/status/StatusPreviewMastodon.vue +++ b/components/status/StatusPreviewMastodon.vue @@ -1,7 +1,8 @@