From db8f43f2f0c48db03986ef81cb199619fe64691e Mon Sep 17 00:00:00 2001 From: cchu42 Date: Thu, 1 Dec 2022 12:39:41 -0500 Subject: [PATCH] Streamline ownership confirmation during sign-up --- .../app/src/components/SignUp/Forms/BlogFeeds.tsx | 6 +----- .../src/components/SignUp/Forms/ChannelFeeds.tsx | 6 +----- .../src/components/SignUp/Forms/GitHubAccount.tsx | 9 ++------- .../app/src/components/SignUp/Forms/RSSFeeds.tsx | 12 +----------- .../app/src/components/SignUp/Forms/Review.tsx | 4 ++++ .../src/components/SignUp/Schema/FormModel.tsx | 15 --------------- .../src/components/SignUp/Schema/FormSchema.tsx | 15 +-------------- src/web/app/src/interfaces/index.ts | 3 --- src/web/app/src/pages/signup.tsx | 6 ------ 9 files changed, 10 insertions(+), 66 deletions(-) diff --git a/src/web/app/src/components/SignUp/Forms/BlogFeeds.tsx b/src/web/app/src/components/SignUp/Forms/BlogFeeds.tsx index 11446819c5..0d96eb9720 100644 --- a/src/web/app/src/components/SignUp/Forms/BlogFeeds.tsx +++ b/src/web/app/src/components/SignUp/Forms/BlogFeeds.tsx @@ -1,7 +1,7 @@ import RSSFeeds from './RSSFeeds'; import formModels from '../Schema/FormModel'; -const { blogs, allBlogs, blogUrl, blogOwnership } = formModels; +const { blogs, allBlogs, blogUrl } = formModels; const BlogFeeds = () => { return ( @@ -19,10 +19,6 @@ const BlogFeeds = () => { selected: blogs.name as any, discovered: allBlogs.name as any, }} - agreement={{ - name: blogOwnership.name, - label: blogOwnership.label, - }} input={{ name: blogUrl.name, label: blogUrl.label, diff --git a/src/web/app/src/components/SignUp/Forms/ChannelFeeds.tsx b/src/web/app/src/components/SignUp/Forms/ChannelFeeds.tsx index 8dcf9fa0c0..705807d69c 100644 --- a/src/web/app/src/components/SignUp/Forms/ChannelFeeds.tsx +++ b/src/web/app/src/components/SignUp/Forms/ChannelFeeds.tsx @@ -1,7 +1,7 @@ import RSSFeeds from './RSSFeeds'; import formModels from '../Schema/FormModel'; -const { channels, allChannels, channelUrl, channelOwnership } = formModels; +const { channels, allChannels, channelUrl } = formModels; const ChannelFeeds = () => { return ( @@ -14,10 +14,6 @@ const ChannelFeeds = () => { selected: channels.name as any, discovered: allChannels.name as any, }} - agreement={{ - name: channelOwnership.name, - label: channelOwnership.label, - }} input={{ name: channelUrl.name, label: channelUrl.label, diff --git a/src/web/app/src/components/SignUp/Forms/GitHubAccount.tsx b/src/web/app/src/components/SignUp/Forms/GitHubAccount.tsx index d1d6a6338b..bf83fffc7a 100644 --- a/src/web/app/src/components/SignUp/Forms/GitHubAccount.tsx +++ b/src/web/app/src/components/SignUp/Forms/GitHubAccount.tsx @@ -5,10 +5,10 @@ import { connect } from 'formik'; import { SignUpForm } from '../../../interfaces'; import formModels from '../Schema/FormModel'; -import { TextInput, CheckBoxInput } from '../FormFields'; +import { TextInput } from '../FormFields'; import PostAvatar from '../../Posts/PostAvatar'; -const { githubUsername, github, githubOwnership } = formModels; +const { githubUsername, github } = formModels; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -178,11 +178,6 @@ const GitHubAccount = connect<{}, SignUpForm>((props) => { )} - ); diff --git a/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx b/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx index 5d2a12ac60..f90a274895 100644 --- a/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx +++ b/src/web/app/src/components/SignUp/Forms/RSSFeeds.tsx @@ -10,7 +10,7 @@ import Checkbox from '@material-ui/core/Checkbox'; import { feedDiscoveryServiceUrl } from '../../../config'; import useAuth from '../../../hooks/use-auth'; import { SignUpForm, DiscoveredFeed, DiscoveredFeeds } from '../../../interfaces'; -import { TextInput, CheckBoxInput } from '../FormFields'; +import { TextInput } from '../FormFields'; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -157,10 +157,6 @@ type RSSFeedsFormProps = { name: string; label: string; }; - agreement: { - name: string; - label: string; - }; noFeedsSelected?: string; }; @@ -173,7 +169,6 @@ const RSSFeeds = connect( buttonText, helperText, noFeedsSelected, - agreement, input, formik, }) => { @@ -319,11 +314,6 @@ const RSSFeeds = connect( - ); diff --git a/src/web/app/src/components/SignUp/Forms/Review.tsx b/src/web/app/src/components/SignUp/Forms/Review.tsx index 62a09c0f49..65607e4adf 100644 --- a/src/web/app/src/components/SignUp/Forms/Review.tsx +++ b/src/web/app/src/components/SignUp/Forms/Review.tsx @@ -157,6 +157,10 @@ const Review = connect<{ accountError: string | undefined }, SignUpForm>((props) +
+ By submitting these information, you confirm you are the owner and/or maintainer of the + accounts entered. +
{props.accountError} diff --git a/src/web/app/src/components/SignUp/Schema/FormModel.tsx b/src/web/app/src/components/SignUp/Schema/FormModel.tsx index 0c60638054..2f6422fe17 100644 --- a/src/web/app/src/components/SignUp/Schema/FormModel.tsx +++ b/src/web/app/src/components/SignUp/Schema/FormModel.tsx @@ -28,11 +28,6 @@ export default { label: 'Github username', requiredErrorMsg: 'Github account is required', }, - githubOwnership: { - name: 'githubOwnership', - label: 'I declare I’m the owner and the maintainer of this GitHub account', - invalidErrorMsg: 'You must be the owner of this account', - }, blogUrl: { name: 'blogUrl', label: 'Blog URL(s), seperated by spaces', @@ -59,14 +54,4 @@ export default { allChannels: { name: 'allChannels', }, - blogOwnership: { - name: 'blogOwnership', - label: 'I declare I’m the owner and the maintainer of this blog account', - invalidErrorMsg: 'You must be the owner of this account', - }, - channelOwnership: { - name: 'channelOwnership', - label: 'I declare I’m the owner and the maintainer of the channel(s) above', - invalidErrorMsg: 'You must be the owner of the channel(s)', - }, }; diff --git a/src/web/app/src/components/SignUp/Schema/FormSchema.tsx b/src/web/app/src/components/SignUp/Schema/FormSchema.tsx index 3d0faed35f..e9a9d38b30 100644 --- a/src/web/app/src/components/SignUp/Schema/FormSchema.tsx +++ b/src/web/app/src/components/SignUp/Schema/FormSchema.tsx @@ -1,4 +1,4 @@ -import { string, array, object, boolean } from 'yup'; +import { string, array, object } from 'yup'; import formModels from './FormModel'; @@ -13,15 +13,12 @@ const { displayName, githubUsername, github, - githubOwnership, blogs, allBlogs, channels, allChannels, blogUrl, channelUrl, - blogOwnership, - channelOwnership, } = formModels; // Each signup step has one validation schema @@ -44,11 +41,6 @@ export default [ avatarUrl: string().url().required(), }) .required(github.invalidErrorMsg), - [githubOwnership.name]: boolean().test( - 'agreed', - githubOwnership.invalidErrorMsg, - (val) => !!val - ), }), // Third step we collect the user blog and the RSSfeeds from it. @@ -56,7 +48,6 @@ export default [ [blogUrl.name]: string(), [blogs.name]: array().of(DiscoveredFeed).min(1, blogs.requiredErrorMsg), [allBlogs.name]: array().of(DiscoveredFeed), - [blogOwnership.name]: boolean().test('agreed', blogOwnership.invalidErrorMsg, (val) => !!val), }), // Fourth step we collect the user YouTube/Twitch channels and the RSSfeeds from it. @@ -64,10 +55,6 @@ export default [ [channelUrl.name]: string(), [channels.name]: array().of(DiscoveredFeed), [allChannels.name]: array().of(DiscoveredFeed), - [channelOwnership.name]: boolean().when(allChannels.name, { - is: (val: {}[]) => !!val.length, - then: (shema) => shema.test('agreed', channelOwnership.invalidErrorMsg, (val) => !!val), - }), }), // Reviewing step has no validation logic. We just display all data that we collected. diff --git a/src/web/app/src/interfaces/index.ts b/src/web/app/src/interfaces/index.ts index 25d88abc9e..c5def06d1b 100644 --- a/src/web/app/src/interfaces/index.ts +++ b/src/web/app/src/interfaces/index.ts @@ -39,15 +39,12 @@ export type SignUpForm = { avatarUrl: string; }; githubUsername: string; - githubOwnership: boolean; blogUrl: string; channelUrl: string; blogs: DiscoveredFeed[]; allBlogs: DiscoveredFeed[]; channels: DiscoveredFeed[]; allChannels: DiscoveredFeed[]; - blogOwnership: boolean; - channelOwnership: boolean; }; export type ThemeName = 'light-default' | 'light-high-contrast' | 'dark-default' | 'dark-dim'; diff --git a/src/web/app/src/pages/signup.tsx b/src/web/app/src/pages/signup.tsx index 98004c9d67..bd6e84aadb 100644 --- a/src/web/app/src/pages/signup.tsx +++ b/src/web/app/src/pages/signup.tsx @@ -41,15 +41,12 @@ const { displayName, githubUsername, github, - githubOwnership, blogUrl, blogs, channels, allBlogs, allChannels, email, - blogOwnership, - channelOwnership, } = formModels; const useStyles = makeStyles((theme: Theme) => @@ -324,7 +321,6 @@ const SignUpPage = () => { [displayName.name]: user?.name, [email.name]: user?.email, [githubUsername.name]: '', - [githubOwnership.name]: false, [github.name]: { username: '', avatarUrl: '', @@ -334,8 +330,6 @@ const SignUpPage = () => { [allBlogs.name]: [] as SignUpForm['allBlogs'], [channels.name]: [] as SignUpForm['channels'], [allChannels.name]: [] as SignUpForm['allChannels'], - [blogOwnership.name]: false, - [channelOwnership.name]: false, } as SignUpForm } >