Separate email and browser ids list
This commit is contained in:
parent
4f19220778
commit
3cb36a36ec
|
@ -222,7 +222,8 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async (
|
||||||
repliedToId,
|
repliedToId,
|
||||||
} = miscData ?? {}
|
} = miscData ?? {}
|
||||||
|
|
||||||
const recipientIdsList: string[] = []
|
const browserRecipientIdsList: string[] = []
|
||||||
|
const emailRecipientIdsList: string[] = []
|
||||||
|
|
||||||
const contractFollowersSnap = await firestore
|
const contractFollowersSnap = await firestore
|
||||||
.collection(`contracts/${sourceContract.id}/follows`)
|
.collection(`contracts/${sourceContract.id}/follows`)
|
||||||
|
@ -271,8 +272,7 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async (
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (
|
||||||
!stillFollowingContract(sourceContract.creatorId) ||
|
!stillFollowingContract(sourceContract.creatorId) ||
|
||||||
sourceUser.id == userId ||
|
sourceUser.id == userId
|
||||||
recipientIdsList.includes(userId)
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
const privateUser = await getPrivateUser(userId)
|
const privateUser = await getPrivateUser(userId)
|
||||||
|
@ -282,11 +282,11 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async (
|
||||||
reason
|
reason
|
||||||
)
|
)
|
||||||
|
|
||||||
if (sendToBrowser) {
|
if (sendToBrowser && !browserRecipientIdsList.includes(userId)) {
|
||||||
await createBrowserNotification(userId, reason)
|
await createBrowserNotification(userId, reason)
|
||||||
recipientIdsList.push(userId)
|
browserRecipientIdsList.push(userId)
|
||||||
}
|
}
|
||||||
if (sendToEmail) {
|
if (sendToEmail && !emailRecipientIdsList.includes(userId)) {
|
||||||
if (sourceType === 'comment') {
|
if (sourceType === 'comment') {
|
||||||
// TODO: change subject of email title to be more specific, i.e.: replied to you on/tagged you on/comment
|
// TODO: change subject of email title to be more specific, i.e.: replied to you on/tagged you on/comment
|
||||||
await sendNewCommentEmail(
|
await sendNewCommentEmail(
|
||||||
|
@ -327,7 +327,7 @@ export const createCommentOrAnswerOrUpdatedContractNotification = async (
|
||||||
resolutionData.resolutionProbability,
|
resolutionData.resolutionProbability,
|
||||||
resolutionData.resolutions
|
resolutionData.resolutions
|
||||||
)
|
)
|
||||||
recipientIdsList.push(userId)
|
emailRecipientIdsList.push(userId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user