ban users from posting (#810)
This commit is contained in:
		
							parent
							
								
									2acc1a8433
								
							
						
					
					
						commit
						03e07037ea
					
				| 
						 | 
					@ -44,6 +44,7 @@ export type User = {
 | 
				
			||||||
  currentBettingStreak?: number
 | 
					  currentBettingStreak?: number
 | 
				
			||||||
  hasSeenContractFollowModal?: boolean
 | 
					  hasSeenContractFollowModal?: boolean
 | 
				
			||||||
  freeMarketsCreated?: number
 | 
					  freeMarketsCreated?: number
 | 
				
			||||||
 | 
					  isBannedFromPosting?: boolean
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type PrivateUser = {
 | 
					export type PrivateUser = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,6 +115,8 @@ export function CreateAnswerPanel(props: { contract: FreeResponseContract }) {
 | 
				
			||||||
  const currentReturn = betAmount ? (currentPayout - betAmount) / betAmount : 0
 | 
					  const currentReturn = betAmount ? (currentPayout - betAmount) / betAmount : 0
 | 
				
			||||||
  const currentReturnPercent = (currentReturn * 100).toFixed() + '%'
 | 
					  const currentReturnPercent = (currentReturn * 100).toFixed() + '%'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (user?.isBannedFromPosting) return <></>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <Col className="gap-4 rounded">
 | 
					    <Col className="gap-4 rounded">
 | 
				
			||||||
      <Col className="flex-1 gap-2">
 | 
					      <Col className="flex-1 gap-2">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,9 @@ export const CreateQuestionButton = (props: {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { user, overrideText, className, query } = props
 | 
					  const { user, overrideText, className, query } = props
 | 
				
			||||||
  const router = useRouter()
 | 
					  const router = useRouter()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (user?.isBannedFromPosting) return <></>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div className={clsx('flex justify-center', className)}>
 | 
					    <div className={clsx('flex justify-center', className)}>
 | 
				
			||||||
      {user ? (
 | 
					      {user ? (
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -382,6 +382,8 @@ export function CommentInput(props: {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const isNumeric = contract.outcomeType === 'NUMERIC'
 | 
					  const isNumeric = contract.outcomeType === 'NUMERIC'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (user?.isBannedFromPosting) return <></>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <>
 | 
					    <>
 | 
				
			||||||
      <Row className={'mb-2 gap-1 sm:gap-2'}>
 | 
					      <Row className={'mb-2 gap-1 sm:gap-2'}>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,6 +76,8 @@ export function CreateGroupButton(props: {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (user.isBannedFromPosting) return <></>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <ConfirmationButton
 | 
					    <ConfirmationButton
 | 
				
			||||||
      openModalBtn={{
 | 
					      openModalBtn={{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,6 +67,18 @@ export default function Create(props: { auth: { user: User } }) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!router.isReady) return <div />
 | 
					  if (!router.isReady) return <div />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (user.isBannedFromPosting)
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					      <Page>
 | 
				
			||||||
 | 
					        <div className="mx-auto w-full max-w-2xl">
 | 
				
			||||||
 | 
					          <div className="rounded-lg px-6 py-4 sm:py-0">
 | 
				
			||||||
 | 
					            <Title className="!mt-0" text="Create a market" />
 | 
				
			||||||
 | 
					            <p>Sorry, you are currently banned from creating a market.</p>
 | 
				
			||||||
 | 
					          </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					      </Page>
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <Page>
 | 
					    <Page>
 | 
				
			||||||
      <SEO
 | 
					      <SEO
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user