diff --git a/changelog/unreleased/bugfix-notifications-mark-all-read.md b/changelog/unreleased/bugfix-notifications-mark-all-read.md new file mode 100644 index 00000000000..720588d0f10 --- /dev/null +++ b/changelog/unreleased/bugfix-notifications-mark-all-read.md @@ -0,0 +1,10 @@ +Bugfix: Mark all notifications as read + +Clicking "Mark all read" in the notifications menu only cleared the list +visually. The request sent to the server was malformed, so the notifications +were not deleted and reappeared after a page reload. This affected the regular +view as well as the Safe. + +The request is now sent correctly and the notifications are removed for good. + +https://github.com/owncloud/ocis/pull/13157 diff --git a/web/packages/web-runtime/src/components/Topbar/Notifications.vue b/web/packages/web-runtime/src/components/Topbar/Notifications.vue index c59c9b55d6e..7e035fa1fcc 100644 --- a/web/packages/web-runtime/src/components/Topbar/Notifications.vue +++ b/web/packages/web-runtime/src/components/Topbar/Notifications.vue @@ -222,7 +222,7 @@ export default { try { yield clientService.httpAuthenticated.delete( 'ocs/v2.php/apps/notifications/api/v1/notifications', - { data: { ids } }, + { ids }, { signal } ) } catch (e) { diff --git a/web/packages/web-runtime/tests/unit/components/Topbar/Notifications.spec.ts b/web/packages/web-runtime/tests/unit/components/Topbar/Notifications.spec.ts index bcaebee6090..68202b8c77d 100644 --- a/web/packages/web-runtime/tests/unit/components/Topbar/Notifications.spec.ts +++ b/web/packages/web-runtime/tests/unit/components/Topbar/Notifications.spec.ts @@ -61,13 +61,20 @@ describe('Notification component', () => { expect(wrapper.find(selectors.notificationsLoading).exists()).toBeTruthy() }) it('marks all notifications as read', async () => { - const notifications = [mock({ messageRich: undefined, object_id })] + const notifications = [ + mock({ messageRich: undefined, object_id, notification_id: 'n1' }) + ] const { wrapper, mocks } = getWrapper({ notifications }) await wrapper.vm.fetchNotificationsTask.last await wrapper.find(selectors.markAll).trigger('click') await wrapper.vm.$nextTick() expect(wrapper.find(selectors.notificationItem).exists()).toBeFalsy() expect(mocks.$clientService.httpAuthenticated.delete).toHaveBeenCalledTimes(1) + expect(mocks.$clientService.httpAuthenticated.delete).toHaveBeenCalledWith( + expect.any(String), + { ids: ['n1'] }, + expect.anything() + ) }) describe('avatar', () => { it('loads based on the username', async () => {