mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
Fix extra inbox notifications (#5550)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
a8c91993de
commit
42fc3a15e9
@ -91,6 +91,9 @@
|
||||
{/if}
|
||||
</span>
|
||||
{/await}
|
||||
{#if hasSeparator}
|
||||
<span class="ml-1" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import activity, { ActivityMessage } from '@hcengineering/activity'
|
||||
import activity, { ActivityMessage, DocUpdateMessage } from '@hcengineering/activity'
|
||||
import chunter, { ChatMessage } from '@hcengineering/chunter'
|
||||
import contact, {
|
||||
Employee,
|
||||
@ -701,7 +701,18 @@ export async function getNotificationTxes (
|
||||
cache: Map<Ref<Doc>, Doc>
|
||||
): Promise<Tx[]> {
|
||||
const res: Tx[] = []
|
||||
const notifyResult = await isShouldNotifyTx(control, tx, originTx, object, target, params.isOwn, params.isSpace)
|
||||
for (const message of activityMessages) {
|
||||
const docMessage = message._class === activity.class.DocUpdateMessage ? (message as DocUpdateMessage) : undefined
|
||||
const notifyResult = await isShouldNotifyTx(
|
||||
control,
|
||||
tx,
|
||||
originTx,
|
||||
object,
|
||||
target,
|
||||
params.isOwn,
|
||||
params.isSpace,
|
||||
docMessage
|
||||
)
|
||||
|
||||
if (notifyResult.allowed) {
|
||||
await pushActivityInboxNotifications(
|
||||
@ -711,7 +722,7 @@ export async function getNotificationTxes (
|
||||
target,
|
||||
object,
|
||||
docNotifyContexts,
|
||||
activityMessages,
|
||||
[message],
|
||||
params.shouldUpdateTimestamp,
|
||||
notifyResult.push,
|
||||
cache
|
||||
@ -719,11 +730,11 @@ export async function getNotificationTxes (
|
||||
}
|
||||
|
||||
if (notifyResult.emails.length === 0) {
|
||||
return res
|
||||
continue
|
||||
}
|
||||
const acc = await getPersonAccountById(target, control)
|
||||
if (acc === undefined) {
|
||||
return res
|
||||
continue
|
||||
}
|
||||
const emp = await getEmployee(acc.person as Ref<Employee>, control)
|
||||
if (emp?.active === true) {
|
||||
@ -737,7 +748,7 @@ export async function getNotificationTxes (
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user