diff --git a/packages/backend/src/om/entitystorage/NotificationES.js b/packages/backend/src/om/entitystorage/NotificationES.js index 949b4037..334a330e 100644 --- a/packages/backend/src/om/entitystorage/NotificationES.js +++ b/packages/backend/src/om/entitystorage/NotificationES.js @@ -27,19 +27,19 @@ class NotificationES extends BaseES { key: 'shown', value: null, }).and(new Eq({ - key: 'awknowledged', + key: 'acknowledge', value: null, })); } - if ( id === 'unawknowledged' ) { + if ( id === 'unacknowledge' ) { return new Eq({ - key: 'awknowledged', + key: 'acknowledge', value: null, }); } - if ( id === 'awknowledged' ) { + if ( id === 'acknowledge' ) { return new IsNotNull({ - key: 'awknowledged', + key: 'acknowledge', }); } }, diff --git a/packages/backend/src/services/NotificationService.js b/packages/backend/src/services/NotificationService.js index 556d3f0c..c04df2b2 100644 --- a/packages/backend/src/services/NotificationService.js +++ b/packages/backend/src/services/NotificationService.js @@ -47,7 +47,7 @@ class NotificationService extends BaseService { router.use(auth2); - [['awk','awknowledged'],['read','read']].forEach(([ep_name, col_name]) => { + [['ack','acknowledged'],['read','read']].forEach(([ep_name, col_name]) => { Endpoint({ route: '/mark-' + ep_name, methods: ['POST'], @@ -61,12 +61,12 @@ class NotificationService extends BaseService { }) } - const awk_ts = Math.floor(Date.now() / 1000); + const ack_ts = Math.floor(Date.now() / 1000); await this.db.write( 'UPDATE `notification` SET ' + col_name + ' = ? ' + 'WHERE uid = ? AND user_id = ? ' + 'LIMIT 1', - [awk_ts, req.body.uid, req.user.id], + [ack_ts, req.body.uid, req.user.id], ); res.json({}); @@ -79,7 +79,7 @@ class NotificationService extends BaseService { // query the users unread notifications const notifications = await this.db.read( 'SELECT * FROM `notification` ' + - 'WHERE user_id=? AND shown IS NULL AND awknowledged IS NULL ' + + 'WHERE user_id=? AND shown IS NULL AND acknowledged IS NULL ' + 'ORDER BY created_at ASC', [user.id] ); diff --git a/packages/backend/src/services/database/sqlite_setup/0011_notification.sql b/packages/backend/src/services/database/sqlite_setup/0011_notification.sql index e514f93b..dfed0e9d 100644 --- a/packages/backend/src/services/database/sqlite_setup/0011_notification.sql +++ b/packages/backend/src/services/database/sqlite_setup/0011_notification.sql @@ -3,7 +3,7 @@ CREATE TABLE `notification` ( `user_id` INTEGER NOT NULL, `uid` TEXT NOT NULL UNIQUE, `value` JSON NOT NULL, - `awknowledged` INTEGER DEFAULT NULL, + `acknowledged` INTEGER DEFAULT NULL, `shown` INTEGER DEFAULT NULL, `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); diff --git a/src/UI/UIDesktop.js b/src/UI/UIDesktop.js index 6a078d14..0ce24719 100644 --- a/src/UI/UIDesktop.js +++ b/src/UI/UIDesktop.js @@ -118,7 +118,7 @@ async function UIDesktop(options){ text: notification.text, icon: icon, click: async () => { - await fetch(`${window.api_origin}/notif/mark-awk`, { + await fetch(`${window.api_origin}/notif/mark-ack`, { method: 'POST', headers: { Authorization: `Bearer ${puter.authToken}`, @@ -144,7 +144,7 @@ async function UIDesktop(options){ title: notification.title, text: notification.text ?? notification.title, click: async () => { - await fetch(`${window.api_origin}/notif/mark-awk`, { + await fetch(`${window.api_origin}/notif/mark-ack`, { method: 'POST', headers: { Authorization: `Bearer ${puter.authToken}`,