1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-03 03:45:36 +02:00

No flickering for sync topic

This commit is contained in:
binwiederhier 2023-01-24 15:31:39 -05:00
parent eecd689ad5
commit 1771cb3fdb
4 changed files with 28 additions and 42 deletions

View file

@ -17,7 +17,7 @@ class SubscriptionManager {
return await db.subscriptions.get(subscriptionId)
}
async add(baseUrl, topic) {
async add(baseUrl, topic, internal) {
const id = topicUrl(baseUrl, topic);
const existingSubscription = await this.get(id);
if (existingSubscription) {
@ -30,7 +30,7 @@ class SubscriptionManager {
mutedUntil: 0,
last: null,
remoteId: null,
internal: false
internal: internal || false
};
await db.subscriptions.put(subscription);
return subscription;
@ -47,7 +47,7 @@ class SubscriptionManager {
const reservation = remoteReservations?.find(r => remote.base_url === config.base_url && remote.topic === r.topic) || null;
await this.update(local.id, {
remoteId: remote.id,
displayName: remote.display_name,
displayName: remote.display_name, // May be undefined
reservation: reservation // May be null!
});
remoteIds.push(remote.id);