Fix mention email notifictions (#5005)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-03-18 12:39:24 +04:00 committed by GitHub
parent 73fe59fd00
commit d3e2436ac4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,10 +56,6 @@ export async function getPersonNotificationTxes (
space: Ref<Space>,
originTx: TxCUD<Doc>
): Promise<Tx[]> {
if (reference.attachedTo === senderId) {
return []
}
const receiver = (
await control.modelDb.findAll(
contact.class.PersonAccount,
@ -74,6 +70,10 @@ export async function getPersonNotificationTxes (
return []
}
if (receiver._id === senderId) {
return []
}
const isAvailable = await isSpaceAvailable(receiver, space, control)
if (!isAvailable) {
@ -87,10 +87,6 @@ export async function getPersonNotificationTxes (
res.push(collaboratorsTx)
}
if (await isReferenceAlreadyNotified(reference, receiver._id, control)) {
return res
}
const doc = (await control.findAll(reference.srcDocClass, { _id: reference.srcDocId }))[0]
if (doc === undefined) {
@ -103,6 +99,11 @@ export async function getPersonNotificationTxes (
}
const notifyResult = await shouldNotifyCommon(control, receiver._id, notification.ids.MentionCommonNotificationType)
if (await isReferenceAlreadyNotified(reference, receiver._id, control)) {
notifyResult.allowed = false
}
const texes = await getCommonNotificationTxes(
control,
doc,