From 18ec299c3594e37306f9b652dd6ae3b3ad1bd503 Mon Sep 17 00:00:00 2001 From: Chen-Yuan Chu <83015577+cychu42@users.noreply.github.com> Date: Wed, 7 Dec 2022 20:14:13 -0500 Subject: [PATCH] Parse twitch feed URL for sign-up confirmation (#3774) --- .../app/src/components/SignUp/Forms/RSSFeeds.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx b/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx index b52a29bf9d..5d2a12ac60 100644 --- a/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx +++ b/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx @@ -238,6 +238,17 @@ const RSSFeeds = connect( setFieldValue(selected, selectedFeeds, true); }; + // Parse FeedUrl by Type to produce desired output for confirmation + const parseFeedUrlByType = ({ feedUrl, type }: DiscoveredFeed) => { + // For twitch URL on channel feed page, parse the feed url to find the twitch URL + if (type === 'twitch') { + const result = feedUrl.match(/https?:\/\/www.twitch.tv\/\w+/); + return result ? result[0] : feedUrl; + } + // By default, return the original feed url + return feedUrl; + }; + useEffect(() => { if (errors[input.name as keyof SignUpForm]) { validateBlog(); @@ -288,7 +299,7 @@ const RSSFeeds = connect( } label={

- {feed.type}: {feed.feedUrl} + {feed.type}: {parseFeedUrlByType(feed)}

} />