Enforce a max comment length
This commit is contained in:
parent
405604adef
commit
cd8b336635
|
@ -25,7 +25,7 @@ import {
|
|||
import { useUser } from '../hooks/use-user'
|
||||
import { Linkify } from './linkify'
|
||||
import { Row } from './layout/row'
|
||||
import { createComment } from '../lib/firebase/comments'
|
||||
import { createComment, MAX_COMMENT_LENGTH } from '../lib/firebase/comments'
|
||||
import { useComments } from '../hooks/use-comments'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
import { ResolutionOrChance } from './contract-card'
|
||||
|
@ -135,6 +135,7 @@ function FeedBet(props: { activityItem: any; feedType: FeedType }) {
|
|||
className="textarea textarea-bordered w-full"
|
||||
placeholder="Add a comment..."
|
||||
rows={3}
|
||||
maxLength={MAX_COMMENT_LENGTH}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
||||
submitComment()
|
||||
|
|
|
@ -14,6 +14,8 @@ import { User } from '../../../common/user'
|
|||
import { Comment } from '../../../common/comment'
|
||||
export type { Comment }
|
||||
|
||||
export const MAX_COMMENT_LENGTH = 10000
|
||||
|
||||
export async function createComment(
|
||||
contractId: string,
|
||||
betId: string,
|
||||
|
@ -27,7 +29,7 @@ export async function createComment(
|
|||
contractId,
|
||||
betId,
|
||||
userId: commenter.id,
|
||||
text,
|
||||
text: text.slice(0, MAX_COMMENT_LENGTH),
|
||||
createdTime: Date.now(),
|
||||
userName: commenter.name,
|
||||
userUsername: commenter.username,
|
||||
|
|
Loading…
Reference in New Issue
Block a user