From 3f9e1fc8dff9d6a5f25f6385c346a124228ea592 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Fri, 18 Aug 2023 13:11:35 +0700 Subject: [PATCH] UBERF-27 Properly handle selection in Inbox (#3605) Signed-off-by: Alexander Onnikov --- plugins/notification-resources/src/components/Activity.svelte | 3 ++- .../notification-resources/src/components/EmployeeInbox.svelte | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/notification-resources/src/components/Activity.svelte b/plugins/notification-resources/src/components/Activity.svelte index b58dbbaf7c..6e2a500d2c 100644 --- a/plugins/notification-resources/src/components/Activity.svelte +++ b/plugins/notification-resources/src/components/Activity.svelte @@ -110,7 +110,8 @@ const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => { if (dir === 'vertical') { - const value = selected + offset + let value = offset + docs.findIndex((p) => p._id === of?._id) + if (value < 0) value = 0 if (filtered[value] !== undefined) { selected = value changeSelected(selected) diff --git a/plugins/notification-resources/src/components/EmployeeInbox.svelte b/plugins/notification-resources/src/components/EmployeeInbox.svelte index 802a3238c6..960bcdfbe4 100644 --- a/plugins/notification-resources/src/components/EmployeeInbox.svelte +++ b/plugins/notification-resources/src/components/EmployeeInbox.svelte @@ -108,7 +108,8 @@ const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => { if (dir === 'vertical') { - const value = selected + offset + let value = offset + docs.findIndex((p) => p._id === of?._id) + if (value < 0) value = 0 if (docs[value] !== undefined) { selected = value changeSelected(selected)