Fix inbox people selection (#3322)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-06-01 17:40:45 +06:00 committed by GitHub
parent 467c7736e6
commit 92f465392d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -24,11 +24,11 @@
import NotificationView from './NotificationView.svelte' import NotificationView from './NotificationView.svelte'
export let filter: 'all' | 'read' | 'unread' = 'all' export let filter: 'all' | 'read' | 'unread' = 'all'
export let _id: Ref<Doc> | undefined
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const query = createQuery() const query = createQuery()
let _id: Ref<Doc> | undefined
let docs: DocUpdates[] = [] let docs: DocUpdates[] = []
let filtered: DocUpdates[] = [] let filtered: DocUpdates[] = []
let loading = true let loading = true
@ -60,7 +60,7 @@
filtered = docs.filter((p) => p.txes.length > 0) filtered = docs.filter((p) => p.txes.length > 0)
} }
listProvider.update(filtered) listProvider.update(filtered)
if (loading || _id === undefined) { if (_id === undefined) {
changeSelected(selected) changeSelected(selected)
} else { } else {
const index = filtered.findIndex((p) => p.attachedTo === _id) const index = filtered.findIndex((p) => p.attachedTo === _id)

View File

@ -37,12 +37,12 @@
$: tabs = [ $: tabs = [
{ {
label: notification.string.Activity, label: notification.string.Activity,
props: { filter }, props: { filter, _id },
component: Activity component: Activity
}, },
{ {
label: notification.string.People, label: notification.string.People,
props: { filter }, props: { filter, _id },
component: People component: People
} }
] ]

View File

@ -25,10 +25,10 @@
import PeopleNotificationView from './PeopleNotificationsView.svelte' import PeopleNotificationView from './PeopleNotificationsView.svelte'
export let filter: 'all' | 'read' | 'unread' = 'all' export let filter: 'all' | 'read' | 'unread' = 'all'
export let _id: Ref<Doc> | undefined
const query = createQuery() const query = createQuery()
let _id: Ref<Doc> | undefined
let docs: DocUpdates[] = [] let docs: DocUpdates[] = []
let map: Map<Ref<Account>, DocUpdates[]> = new Map() let map: Map<Ref<Account>, DocUpdates[]> = new Map()
let accounts: EmployeeAccount[] = [] let accounts: EmployeeAccount[] = []
@ -90,7 +90,7 @@
accounts = Array.from(map.keys()) accounts = Array.from(map.keys())
.map((p) => $employeeAccountByIdStore.get(p as Ref<EmployeeAccount>)) .map((p) => $employeeAccountByIdStore.get(p as Ref<EmployeeAccount>))
.filter((p) => p !== undefined) as EmployeeAccount[] .filter((p) => p !== undefined) as EmployeeAccount[]
if (loading || _id === undefined) { if (_id === undefined) {
changeSelected(selected) changeSelected(selected)
} else { } else {
const index = filtered.findIndex((p) => p.attachedTo === _id) const index = filtered.findIndex((p) => p.attachedTo === _id)