diff --git a/common/envs/prod.ts b/common/envs/prod.ts index f8aaf4cc..a5506b6e 100644 --- a/common/envs/prod.ts +++ b/common/envs/prod.ts @@ -18,6 +18,7 @@ export type EnvConfig = { faviconPath?: string // Should be a file in /public navbarLogoPath?: string newQuestionPlaceholders: string[] + whitelistCreators?: string[] // Currency controls fixedAnte?: number diff --git a/common/envs/salemcenter.ts b/common/envs/salemcenter.ts index 197aeb42..b520f6c0 100644 --- a/common/envs/salemcenter.ts +++ b/common/envs/salemcenter.ts @@ -20,4 +20,5 @@ export const SALEM_CENTER_CONFIG: EnvConfig = { faviconPath: '/salem-center/logo.ico', navbarLogoPath: '/salem-center/salem-center-logo.svg', newQuestionPlaceholders: [], + whitelistCreators: ['RichardHanania', 'SalemCenter'], } diff --git a/web/components/nav/sidebar.tsx b/web/components/nav/sidebar.tsx index 839ae0d8..60c353fc 100644 --- a/web/components/nav/sidebar.tsx +++ b/web/components/nav/sidebar.tsx @@ -19,7 +19,7 @@ import { MenuButton } from './menu' import { ProfileSummary } from './profile-menu' import NotificationsIcon from 'web/components/notifications-icon' import React, { useEffect, useState } from 'react' -import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' +import { ENV_CONFIG, IS_PRIVATE_MANIFOLD } from 'common/envs/constants' import { CreateQuestionButton } from 'web/components/create-question-button' import { useMemberGroups } from 'web/hooks/use-group' import { groupPath } from 'web/lib/firebase/groups' @@ -214,7 +214,7 @@ export default function Sidebar(props: { className?: string }) { <nav aria-label="Sidebar" className={className}> <ManifoldLogo className="py-6" twoLine /> - {user?.username === 'RichardHanania' && ( + {ENV_CONFIG.whitelistCreators?.includes(user?.username ?? '') && ( <CreateQuestionButton user={user} /> )} <Spacer h={4} /> diff --git a/web/pages/create.tsx b/web/pages/create.tsx index 32f9e6db..ebbf2c82 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -28,6 +28,7 @@ import { GroupSelector } from 'web/components/groups/group-selector' import { User } from 'common/user' import { TextEditor, useTextEditor } from 'web/components/editor' import { Checkbox } from 'web/components/checkbox' +import { ENV_CONFIG } from 'common/envs/constants' type NewQuestionParams = { groupId?: string @@ -57,7 +58,12 @@ export default function Create() { const creator = useUser() useEffect(() => { if (creator === null) router.push('/') - if (creator?.username !== 'RichardHanania') router.push('/') + if ( + ENV_CONFIG.whitelistCreators && + !ENV_CONFIG.whitelistCreators?.includes(creator?.username ?? '') + ) { + router.push('/') + } }, [creator, router]) if (!router.isReady || !creator) return <div />