From 1180311984a0593a972e0d75ec35d0b0c548f87f Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 6 Jan 2023 19:03:12 +0100 Subject: [PATCH] feat: check if title contains a username --- components/status/StatusPreviewCard.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/status/StatusPreviewCard.vue b/components/status/StatusPreviewCard.vue index 9db9b6d3..d8629d78 100644 --- a/components/status/StatusPreviewCard.vue +++ b/components/status/StatusPreviewCard.vue @@ -23,8 +23,8 @@ const providerName = $computed(() => props.card.providerName ? props.card.provid const gitHubCards = $(useFeatureFlag('experimentalGitHubCards')) -// TODO: regex test the card.title value -const isMastodonLink = true +// checks if title contains a username +const isMastodonLink = props.card.title.match(/@+[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/gi) // TODO: handle card.type: 'photo' | 'video' | 'rich'; const cardTypeIconMap: Record = {