From d121e59189200bc3a4e34a2efa83322c1d6ed083 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Wed, 12 Jan 2022 01:47:56 -0500 Subject: [PATCH] Only permit comments within an hour of betting --- web/components/contract-feed.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 9021e8d6..6c068116 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -86,6 +86,8 @@ function FeedBet(props: { activityItem: any }) { const { id, contractId, amount, outcome, createdTime } = activityItem const user = useUser() const isCreator = user?.id == activityItem.userId + // The creator can comment if the bet was posted in the last hour + const canComment = isCreator && Date.now() - createdTime < 60 * 60 * 1000 const [comment, setComment] = useState('') async function submitComment() { @@ -106,7 +108,7 @@ function FeedBet(props: { activityItem: any }) { {isCreator ? 'You' : 'A trader'} placed{' '} {formatMoney(amount)} on {' '} - {isCreator && ( + {canComment && ( // Allow user to comment in an textarea if they are the creator