From 03e07037ea43d54fef0e421589c526e883ab97a8 Mon Sep 17 00:00:00 2001 From: mantikoros <95266179+mantikoros@users.noreply.github.com> Date: Sun, 28 Aug 2022 00:23:25 -0500 Subject: [PATCH] ban users from posting (#810) --- common/user.ts | 1 + web/components/answers/create-answer-panel.tsx | 2 ++ web/components/create-question-button.tsx | 3 +++ web/components/feed/feed-comments.tsx | 2 ++ web/components/groups/create-group-button.tsx | 2 ++ web/pages/create.tsx | 12 ++++++++++++ 6 files changed, 22 insertions(+) diff --git a/common/user.ts b/common/user.ts index 48a3d59c..e3c9d181 100644 --- a/common/user.ts +++ b/common/user.ts @@ -44,6 +44,7 @@ export type User = { currentBettingStreak?: number hasSeenContractFollowModal?: boolean freeMarketsCreated?: number + isBannedFromPosting?: boolean } export type PrivateUser = { diff --git a/web/components/answers/create-answer-panel.tsx b/web/components/answers/create-answer-panel.tsx index ce266778..6290cf44 100644 --- a/web/components/answers/create-answer-panel.tsx +++ b/web/components/answers/create-answer-panel.tsx @@ -115,6 +115,8 @@ export function CreateAnswerPanel(props: { contract: FreeResponseContract }) { const currentReturn = betAmount ? (currentPayout - betAmount) / betAmount : 0 const currentReturnPercent = (currentReturn * 100).toFixed() + '%' + if (user?.isBannedFromPosting) return <> + return ( diff --git a/web/components/create-question-button.tsx b/web/components/create-question-button.tsx index 1b8ac11e..0ea28635 100644 --- a/web/components/create-question-button.tsx +++ b/web/components/create-question-button.tsx @@ -18,6 +18,9 @@ export const CreateQuestionButton = (props: { const { user, overrideText, className, query } = props const router = useRouter() + + if (user?.isBannedFromPosting) return <> + return (
{user ? ( diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx index 0541a7ba..c3332373 100644 --- a/web/components/feed/feed-comments.tsx +++ b/web/components/feed/feed-comments.tsx @@ -382,6 +382,8 @@ export function CommentInput(props: { const isNumeric = contract.outcomeType === 'NUMERIC' + if (user?.isBannedFromPosting) return <> + return ( <> diff --git a/web/components/groups/create-group-button.tsx b/web/components/groups/create-group-button.tsx index 360c4ea8..435dc741 100644 --- a/web/components/groups/create-group-button.tsx +++ b/web/components/groups/create-group-button.tsx @@ -76,6 +76,8 @@ export function CreateGroupButton(props: { } } + if (user.isBannedFromPosting) return <> + return ( + if (user.isBannedFromPosting) + return ( + +
+
+ + <p>Sorry, you are currently banned from creating a market.</p> + </div> + </div> + </Page> + ) + return ( <Page> <SEO