This commit is contained in:
Martti Malmi 2023-01-26 16:16:42 +02:00
parent 6e74604cd7
commit 5269dccb08
2 changed files with 10 additions and 2 deletions

View File

@ -774,6 +774,7 @@ export default {
// only handle one boost per post per user. TODO update with newer event if needed.
if (!this.boostsByMessageId.get(id)?.has(event.pubkey)) {
this.boostsByMessageId.get(id)?.add(event.pubkey);
this.handleNote(event);
}
},
handleReaction(event: Event) {
@ -937,6 +938,9 @@ export default {
}
},
updateUnseenNotificationCount: debounce((_this) => {
if (!_this.notificationsSeenTime) {
return;
}
let count = 0;
for (const id of _this.notifications.eventIds) {
const event = _this.eventsById.get(id);
@ -1179,8 +1183,8 @@ export default {
this.public.get({ path: 'notifications/lastOpened', authors: [myPub] }, (time) => {
time = time.value;
if (time !== this.notificationsSeenTime) {
localForage.setItem('notificationsSeenTime', time.value);
this.notificationsSeenTime = time.value;
this.notificationsSeenTime = time;
localForage.setItem('notificationsSeenTime', time);
this.updateUnseenNotificationCount(this);
}
});

View File

@ -10,6 +10,7 @@ import iris from 'iris-lib';
import _ from 'lodash';
import { route } from 'preact-router';
import Nostr from "../Nostr";
import localForage from "localforage";
const bech32 = require('bech32-buffer');
function maybeGoToChat(key) {
@ -118,6 +119,9 @@ class Login extends Component {
}, 100);
// follow the developer's nostr key also
this.base.style = 'display:none';
const now = Math.floor(Date.now() / 1000);
Nostr.notificationsSeenTime = now;
localForage.setItem('notificationsSeenTime', now);
}
onNameChange(event) {