Skip to content

Commit d41961e

Browse files
committed
v14.2.3
1 parent 54aaf41 commit d41961e

File tree

6 files changed

+26
-17
lines changed

6 files changed

+26
-17
lines changed

build/cjs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "14.2.2",
3+
"version": "14.2.3",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/14.2.3/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapNotificationManager.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,25 @@ export default class GleapNotificationManager {
5252

5353
reloadNotificationsFromCache() {
5454
// Load persisted notifications.
55-
const notificationsFromCache = loadFromGleapCache(
56-
this.unreadNotificationsKey
57-
);
58-
if (notificationsFromCache && notificationsFromCache.length > 0) {
59-
if (notificationsFromCache.length > 2) {
60-
this.notifications = notificationsFromCache.splice(
61-
0,
62-
notificationsFromCache.length - 2
55+
try {
56+
const notificationsFromCache = loadFromGleapCache(
57+
this.unreadNotificationsKey
58+
);
59+
if (notificationsFromCache && notificationsFromCache.length > 0) {
60+
let nots = notificationsFromCache.filter(
61+
(notification) =>
62+
new Date(notification.createdAt) >
63+
new Date(Date.now() - 1 * 60 * 60 * 1000)
6364
);
64-
} else {
65-
this.notifications = notificationsFromCache;
65+
66+
if (nots.length > 2) {
67+
this.notifications = nots.splice(0, nots.length - 2);
68+
} else {
69+
this.notifications = nots;
70+
}
71+
this.renderNotifications();
6672
}
67-
this.renderNotifications();
68-
}
73+
} catch (exp) {}
6974
}
7075

7176
setNotificationCount(unreadCount) {
@@ -141,7 +146,10 @@ export default class GleapNotificationManager {
141146
const elem = document.createElement("div");
142147
elem.onclick = () => {
143148
if (notification.data.conversation) {
144-
Gleap.openConversation(notification.data.conversation.shareToken, true);
149+
Gleap.openConversation(
150+
notification.data.conversation.shareToken,
151+
true
152+
);
145153
} else if (notification.data.news) {
146154
Gleap.openNewsArticle(notification.data.news.id, true);
147155
} else if (notification.data.checklist) {

0 commit comments

Comments
 (0)