diff --git a/web/components/feed/feed-items.tsx b/web/components/feed/feed-items.tsx index 1f5f166a..7d84fe49 100644 --- a/web/components/feed/feed-items.tsx +++ b/web/components/feed/feed-items.tsx @@ -25,11 +25,7 @@ import { import { useUser } from '../../hooks/use-user' import { Linkify } from '../linkify' import { Row } from '../layout/row' -import { - canAddComment, - createComment, - MAX_COMMENT_LENGTH, -} from '../../lib/firebase/comments' +import { createComment, MAX_COMMENT_LENGTH } from '../../lib/firebase/comments' import { formatMoney } from '../../../common/util/format' import { Comment } from '../../../common/comment' import { ResolutionOrChance } from '../contract-card' @@ -180,11 +176,11 @@ function FeedBet(props: { const isSelf = user?.id === userId // You can comment if your bet was posted in the last hour - const canComment = canAddComment(createdTime, isSelf) + const canComment = isSelf && Date.now() - createdTime < 60 * 60 * 1000 const [comment, setComment] = useState('') async function submitComment() { - if (!user || !comment) return + if (!user || !comment || !canComment) return await createComment(contract.id, id, comment, user) } @@ -219,8 +215,7 @@ function FeedBet(props: { )} - {canComment && ( - // Allow user to comment in an textarea if they are the creator + {(canComment || comment) && (