Only use bets by current user for comment input
This commit is contained in:
parent
c13c02f8c0
commit
2352847ab4
|
@ -31,7 +31,7 @@ type BaseActivityItem = {
|
|||
|
||||
export type CommentInputItem = BaseActivityItem & {
|
||||
type: 'commentInput'
|
||||
bets: Bet[]
|
||||
betsByCurrentUser: Bet[]
|
||||
comments: Comment[]
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ function getCommentsWithPositions(
|
|||
id: comment.id,
|
||||
contract: contract,
|
||||
comment,
|
||||
betsBySameUser: bets.length === 0 ? [] : betsByUserId[comment.userId],
|
||||
betsBySameUser: bets.length === 0 ? [] : betsByUserId[comment.userId] ?? [],
|
||||
truncate: true,
|
||||
hideOutcome: false,
|
||||
smallAvatar: false,
|
||||
|
@ -385,7 +385,7 @@ export function getAllContractActivityItems(
|
|||
type: 'commentInput',
|
||||
id: 'commentInput',
|
||||
contract,
|
||||
bets: [],
|
||||
betsByCurrentUser: [],
|
||||
comments: [],
|
||||
})
|
||||
} else {
|
||||
|
@ -411,7 +411,7 @@ export function getAllContractActivityItems(
|
|||
type: 'commentInput',
|
||||
id: 'commentInput',
|
||||
contract,
|
||||
bets: [],
|
||||
betsByCurrentUser: [],
|
||||
comments: [],
|
||||
})
|
||||
}
|
||||
|
@ -507,7 +507,9 @@ export function getSpecificContractActivityItems(
|
|||
type: 'commentInput',
|
||||
id: 'commentInput',
|
||||
contract,
|
||||
bets: bets,
|
||||
betsByCurrentUser: user
|
||||
? bets.filter((bet) => bet.userId === user.id)
|
||||
: [],
|
||||
comments: comments,
|
||||
})
|
||||
break
|
||||
|
|
|
@ -221,10 +221,10 @@ export function FeedComment(props: {
|
|||
|
||||
export function CommentInput(props: {
|
||||
contract: Contract
|
||||
bets: Bet[]
|
||||
betsByCurrentUser: Bet[]
|
||||
comments: Comment[]
|
||||
}) {
|
||||
const { contract, bets, comments } = props
|
||||
const { contract, betsByCurrentUser, comments } = props
|
||||
const user = useUser()
|
||||
const [comment, setComment] = useState('')
|
||||
|
||||
|
@ -238,7 +238,7 @@ export function CommentInput(props: {
|
|||
}
|
||||
|
||||
// Should this be oldest bet or most recent bet?
|
||||
const mostRecentCommentableBet = bets
|
||||
const mostRecentCommentableBet = betsByCurrentUser
|
||||
.filter(
|
||||
(bet) =>
|
||||
canCommentOnBet(bet.userId, bet.createdTime, user) &&
|
||||
|
@ -258,7 +258,7 @@ export function CommentInput(props: {
|
|||
)
|
||||
}
|
||||
const { userPosition, userPositionMoney, yesFloorShares, noFloorShares } =
|
||||
getBettorsPosition(contract, Date.now(), bets)
|
||||
getBettorsPosition(contract, Date.now(), betsByCurrentUser)
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue
Block a user