Only permit comments within an hour of betting
This commit is contained in:
parent
8839ffc492
commit
d121e59189
|
@ -86,6 +86,8 @@ function FeedBet(props: { activityItem: any }) {
|
||||||
const { id, contractId, amount, outcome, createdTime } = activityItem
|
const { id, contractId, amount, outcome, createdTime } = activityItem
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const isCreator = user?.id == activityItem.userId
|
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('')
|
const [comment, setComment] = useState('')
|
||||||
async function submitComment() {
|
async function submitComment() {
|
||||||
|
@ -106,7 +108,7 @@ function FeedBet(props: { activityItem: any }) {
|
||||||
<span>{isCreator ? 'You' : 'A trader'}</span> placed{' '}
|
<span>{isCreator ? 'You' : 'A trader'}</span> placed{' '}
|
||||||
{formatMoney(amount)} on <OutcomeLabel outcome={outcome} />{' '}
|
{formatMoney(amount)} on <OutcomeLabel outcome={outcome} />{' '}
|
||||||
<Timestamp time={createdTime} />
|
<Timestamp time={createdTime} />
|
||||||
{isCreator && (
|
{canComment && (
|
||||||
// Allow user to comment in an textarea if they are the creator
|
// Allow user to comment in an textarea if they are the creator
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<textarea
|
<textarea
|
||||||
|
|
Loading…
Reference in New Issue
Block a user