Whitelist SalemCenter as a market creator as well.

This commit is contained in:
James Grugett 2022-07-15 00:58:39 -05:00
parent c15292e2cb
commit 02aa13f7d1
4 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,7 @@ export type EnvConfig = {
faviconPath?: string // Should be a file in /public faviconPath?: string // Should be a file in /public
navbarLogoPath?: string navbarLogoPath?: string
newQuestionPlaceholders: string[] newQuestionPlaceholders: string[]
whitelistCreators?: string[]
// Currency controls // Currency controls
fixedAnte?: number fixedAnte?: number

View File

@ -20,4 +20,5 @@ export const SALEM_CENTER_CONFIG: EnvConfig = {
faviconPath: '/salem-center/logo.ico', faviconPath: '/salem-center/logo.ico',
navbarLogoPath: '/salem-center/salem-center-logo.svg', navbarLogoPath: '/salem-center/salem-center-logo.svg',
newQuestionPlaceholders: [], newQuestionPlaceholders: [],
whitelistCreators: ['RichardHanania', 'SalemCenter'],
} }

View File

@ -19,7 +19,7 @@ import { MenuButton } from './menu'
import { ProfileSummary } from './profile-menu' import { ProfileSummary } from './profile-menu'
import NotificationsIcon from 'web/components/notifications-icon' import NotificationsIcon from 'web/components/notifications-icon'
import React, { useEffect, useState } from 'react' 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 { CreateQuestionButton } from 'web/components/create-question-button'
import { useMemberGroups } from 'web/hooks/use-group' import { useMemberGroups } from 'web/hooks/use-group'
import { groupPath } from 'web/lib/firebase/groups' import { groupPath } from 'web/lib/firebase/groups'
@ -214,7 +214,7 @@ export default function Sidebar(props: { className?: string }) {
<nav aria-label="Sidebar" className={className}> <nav aria-label="Sidebar" className={className}>
<ManifoldLogo className="py-6" twoLine /> <ManifoldLogo className="py-6" twoLine />
{user?.username === 'RichardHanania' && ( {ENV_CONFIG.whitelistCreators?.includes(user?.username ?? '') && (
<CreateQuestionButton user={user} /> <CreateQuestionButton user={user} />
)} )}
<Spacer h={4} /> <Spacer h={4} />

View File

@ -28,6 +28,7 @@ import { GroupSelector } from 'web/components/groups/group-selector'
import { User } from 'common/user' import { User } from 'common/user'
import { TextEditor, useTextEditor } from 'web/components/editor' import { TextEditor, useTextEditor } from 'web/components/editor'
import { Checkbox } from 'web/components/checkbox' import { Checkbox } from 'web/components/checkbox'
import { ENV_CONFIG } from 'common/envs/constants'
type NewQuestionParams = { type NewQuestionParams = {
groupId?: string groupId?: string
@ -57,7 +58,12 @@ export default function Create() {
const creator = useUser() const creator = useUser()
useEffect(() => { useEffect(() => {
if (creator === null) router.push('/') 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]) }, [creator, router])
if (!router.isReady || !creator) return <div /> if (!router.isReady || !creator) return <div />