Fix old FR comments displayed in general section

This commit is contained in:
Ian Philips 2022-05-17 14:17:00 -06:00
parent c081eec5f8
commit fa98b9f7c7
2 changed files with 10 additions and 10 deletions

View File

@ -87,7 +87,6 @@ export type ResolveItem = BaseActivityItem & {
type: 'resolve'
}
export const GENERAL_COMMENTS_OUTCOME_ID = 'General Comments'
const DAY_IN_MS = 24 * 60 * 60 * 1000
const ABBREVIATED_NUM_COMMENTS_OR_BETS_TO_SHOW = 3
@ -295,8 +294,6 @@ function getAnswerAndCommentInputGroups(
)
const items = getCommentThreads(bets, answerComments, contract)
if (outcome === GENERAL_COMMENTS_OUTCOME_ID) items.reverse()
return {
id: outcome,
type: 'answergroup' as const,
@ -520,6 +517,13 @@ export function getRecentContractActivityItems(
return [questionItem, ...items]
}
function commentIsGeneralComment(comment: Comment, contract: Contract) {
return (
comment.answerOutcome === undefined &&
(contract.outcomeType !== 'BINARY' ? comment.betId === undefined : true)
)
}
export function getSpecificContractActivityItems(
contract: Contract,
bets: Bet[],
@ -550,8 +554,8 @@ export function getSpecificContractActivityItems(
break
case 'comments':
const nonFreeResponseComments = comments.filter(
(comment) => comment.answerOutcome === undefined
const nonFreeResponseComments = comments.filter((comment) =>
commentIsGeneralComment(comment, contract)
)
const nonFreeResponseBets =
contract.outcomeType === 'FREE_RESPONSE' ? [] : bets

View File

@ -1,7 +1,6 @@
import { Bet } from 'common/bet'
import { Comment } from 'common/comment'
import { User } from 'common/user'
import { GENERAL_COMMENTS_OUTCOME_ID } from 'web/components/feed/activity-items'
// TODO: move feed commment and comment thread in here when sinclair confirms they're not working on them rn
export function getMostRecentCommentableBet(
@ -19,10 +18,7 @@ export function getMostRecentCommentableBet(
) {
if (!answerOutcome) return true
// If we're in free response, don't allow commenting on ante bet
return (
bet.outcome !== GENERAL_COMMENTS_OUTCOME_ID &&
answerOutcome === bet.outcome
)
return answerOutcome === bet.outcome
}
return false
})