@liveblocks/emails 2.22.3 → 2.22.4-emails2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ var _core = require('@liveblocks/core');
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/emails";
|
|
6
|
-
var PKG_VERSION = "2.22.
|
|
6
|
+
var PKG_VERSION = "2.22.4-emails2";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// ../../node_modules/lib0/map.js
|
|
@@ -8450,16 +8450,19 @@ function filterCommentsWithBody(comments) {
|
|
|
8450
8450
|
var getUnreadComments = ({
|
|
8451
8451
|
comments,
|
|
8452
8452
|
inboxNotification,
|
|
8453
|
+
notificationTriggerAt,
|
|
8453
8454
|
userId
|
|
8454
8455
|
}) => {
|
|
8455
8456
|
const commentsWithBody = filterCommentsWithBody(comments);
|
|
8456
|
-
const
|
|
8457
|
+
const notAuthoredComments = commentsWithBody.filter(
|
|
8458
|
+
(c) => c.userId !== userId
|
|
8459
|
+
);
|
|
8457
8460
|
const readAt = inboxNotification.readAt;
|
|
8458
|
-
return
|
|
8461
|
+
return notAuthoredComments.filter((c) => {
|
|
8459
8462
|
if (readAt !== null) {
|
|
8460
|
-
return c.createdAt > readAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8463
|
+
return c.createdAt > readAt && c.createdAt >= notificationTriggerAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8461
8464
|
}
|
|
8462
|
-
return c.createdAt <= inboxNotification.notifiedAt;
|
|
8465
|
+
return c.createdAt >= notificationTriggerAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8463
8466
|
});
|
|
8464
8467
|
};
|
|
8465
8468
|
var getLastUnreadCommentWithMention = ({
|
|
@@ -8480,10 +8483,12 @@ var extractThreadNotificationData = async ({
|
|
|
8480
8483
|
client.getThread({ roomId, threadId }),
|
|
8481
8484
|
client.getInboxNotification({ inboxNotificationId, userId })
|
|
8482
8485
|
]);
|
|
8486
|
+
const notificationTriggerAt = new Date(event.data.triggeredAt);
|
|
8483
8487
|
const unreadComments = getUnreadComments({
|
|
8484
8488
|
comments: thread.comments,
|
|
8485
8489
|
inboxNotification,
|
|
8486
|
-
userId
|
|
8490
|
+
userId,
|
|
8491
|
+
notificationTriggerAt
|
|
8487
8492
|
});
|
|
8488
8493
|
if (unreadComments.length <= 0) {
|
|
8489
8494
|
return null;
|