diff --git a/web/components/award-bounty-button.tsx b/web/components/award-bounty-button.tsx
index 865678c7..7a69cf15 100644
--- a/web/components/award-bounty-button.tsx
+++ b/web/components/award-bounty-button.tsx
@@ -27,6 +27,7 @@ export function AwardBountyButton(prop: {
awardCommentBounty(data)
.then((_) => {
console.log('success')
+ track('award comment bounty', data)
})
.catch((reason) => console.log('Server error:', reason))
diff --git a/web/components/contract/add-comment-bounty.tsx b/web/components/contract/add-comment-bounty.tsx
index 4aa36e09..8b716e71 100644
--- a/web/components/contract/add-comment-bounty.tsx
+++ b/web/components/contract/add-comment-bounty.tsx
@@ -31,6 +31,10 @@ export function AddCommentBountyPanel(props: { contract: Contract }) {
addCommentBounty({ amount, contractId })
.then((_) => {
+ track('offer comment bounty', {
+ amount,
+ contractId,
+ })
setIsSuccess(true)
setError(undefined)
setIsLoading(false)
diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx
index ed0c3f15..20d124f8 100644
--- a/web/components/feed/feed-comments.tsx
+++ b/web/components/feed/feed-comments.tsx
@@ -219,28 +219,32 @@ export function ContractCommentInput(props: {
onSubmitComment?: () => void
}) {
const user = useUser()
+ const { contract, parentAnswerOutcome, parentCommentId, replyTo, className } =
+ props
+ const { openCommentBounties } = contract
async function onSubmitComment(editor: Editor) {
if (!user) {
track('sign in to comment')
return await firebaseLogin()
}
await createCommentOnContract(
- props.contract.id,
+ contract.id,
editor.getJSON(),
user,
- props.parentAnswerOutcome,
- props.parentCommentId
+ !!openCommentBounties,
+ parentAnswerOutcome,
+ parentCommentId
)
props.onSubmitComment?.()
}
return (
)
}
diff --git a/web/lib/firebase/comments.ts b/web/lib/firebase/comments.ts
index 733a1e06..e1b4ccef 100644
--- a/web/lib/firebase/comments.ts
+++ b/web/lib/firebase/comments.ts
@@ -35,6 +35,7 @@ export async function createCommentOnContract(
contractId: string,
content: JSONContent,
user: User,
+ onContractWithBounty: boolean,
answerOutcome?: string,
replyToCommentId?: string
) {
@@ -50,7 +51,8 @@ export async function createCommentOnContract(
content,
user,
ref,
- replyToCommentId
+ replyToCommentId,
+ onContractWithBounty
)
}
export async function createCommentOnGroup(
@@ -95,7 +97,8 @@ async function createComment(
content: JSONContent,
user: User,
ref: DocumentReference,
- replyToCommentId?: string
+ replyToCommentId?: string,
+ onContractWithBounty?: boolean
) {
const comment = removeUndefinedProps({
id: ref.id,
@@ -108,13 +111,19 @@ async function createComment(
replyToCommentId: replyToCommentId,
...extraFields,
})
-
- track(`${extraFields.commentType} message`, {
- user,
- commentId: ref.id,
- surfaceId,
- replyToCommentId: replyToCommentId,
- })
+ track(
+ `${extraFields.commentType} message`,
+ removeUndefinedProps({
+ user,
+ commentId: ref.id,
+ surfaceId,
+ replyToCommentId: replyToCommentId,
+ onContractWithBounty:
+ extraFields.commentType === 'contract'
+ ? onContractWithBounty
+ : undefined,
+ })
+ )
return await setDoc(ref, comment)
}