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