1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-23 19:59:26 +01:00

Fix param reassignment issue

This commit is contained in:
nimbleghost 2023-05-24 18:08:59 +02:00
parent 4a0a22566a
commit be6d962cc3
2 changed files with 9 additions and 11 deletions

View file

@ -105,9 +105,12 @@ class SubscriptionManager {
return false; return false;
} }
try { try {
// eslint-disable-next-line no-param-reassign await db.notifications.add({
notification.new = 1; // New marker (used for bubble indicator); cannot be boolean; Dexie index limitation ...notification,
await db.notifications.add({ ...notification, subscriptionId }); // FIXME consider put() for double tab subscriptionId,
// New marker (used for bubble indicator); cannot be boolean; Dexie index limitation
new: 1,
}); // FIXME consider put() for double tab
await db.subscriptions.update(subscriptionId, { await db.subscriptions.update(subscriptionId, {
last: notification.id, last: notification.id,
}); });

View file

@ -436,15 +436,10 @@ const ACTION_LABEL_SUFFIX = {
}; };
const updateActionStatus = (notification, action, progress, error) => { const updateActionStatus = (notification, action, progress, error) => {
// TODO(eslint): Fix by spreading? Does the code depend on the change, though? subscriptionManager.updateNotification({
// eslint-disable-next-line no-param-reassign ...notification,
notification.actions = notification.actions.map((a) => { actions: notification.actions.map((a) => (a.id === action.id ? { ...a, progress, error } : a)),
if (a.id !== action.id) {
return a;
}
return { ...a, progress, error };
}); });
subscriptionManager.updateNotification(notification);
}; };
const performHttpAction = async (notification, action) => { const performHttpAction = async (notification, action) => {