diff --git a/plugins/chunter-resources/src/channelDataProvider.ts b/plugins/chunter-resources/src/channelDataProvider.ts index 13b26a3528..b86b228112 100644 --- a/plugins/chunter-resources/src/channelDataProvider.ts +++ b/plugins/chunter-resources/src/channelDataProvider.ts @@ -197,7 +197,7 @@ export class ChannelDataProvider implements IChannelDataProvider { const startPosition = this.getStartPosition(selectedMsg ?? this.selectedMsgId, firstNewMsgIndex) const count = metadata.length - const isLoadingLatest = startPosition === undefined || startPosition === -1 + const isLoadingLatest = startPosition === undefined || startPosition === -1 || count - startPosition <= this.limit if (loadAll) { this.loadTail(undefined, combineActivityMessages) @@ -206,20 +206,9 @@ export class ChannelDataProvider implements IChannelDataProvider { this.isTailLoading.set(true) const tailStart = metadata[startIndex]?.createdOn this.loadTail(tailStart) - } else if (count - startPosition <= this.limit) { - this.isTailLoading.set(true) - const tailStart = metadata[startPosition]?.createdOn - this.loadTail(tailStart) - await this.loadMore('backward', tailStart) } else { - const start = metadata[startPosition]?.createdOn - - if (startPosition === 0) { - await this.loadMore('forward', metadata[startPosition]?.createdOn, this.limit) - } else { - await this.loadMore('backward', start, this.limit / 2) - await this.loadMore('forward', metadata[startPosition - 1]?.createdOn, this.limit / 2) - } + const newStart = Math.max(startPosition - this.limit / 2, 0) + await this.loadMore('forward', metadata[newStart]?.createdOn, this.limit) } this.isInitialLoadingStore.set(false) diff --git a/plugins/chunter-resources/src/components/ChannelScrollView.svelte b/plugins/chunter-resources/src/components/ChannelScrollView.svelte index faa978adef..5eafc2925b 100644 --- a/plugins/chunter-resources/src/components/ChannelScrollView.svelte +++ b/plugins/chunter-resources/src/components/ChannelScrollView.svelte @@ -236,7 +236,7 @@ const { scrollHeight, scrollTop, clientHeight } = scrollElement - return Math.ceil(scrollTop + clientHeight) === scrollHeight + return scrollHeight - Math.ceil(scrollTop + clientHeight) <= 0 } let scrollToRestore = 0 diff --git a/plugins/notification-resources/src/components/NotifyContextIcon.svelte b/plugins/notification-resources/src/components/NotifyContextIcon.svelte index 6d901aea93..3287fe7d12 100644 --- a/plugins/notification-resources/src/components/NotifyContextIcon.svelte +++ b/plugins/notification-resources/src/components/NotifyContextIcon.svelte @@ -32,6 +32,9 @@ let object: Doc | undefined = undefined + $: if (object?._id !== value.attachedTo) { + object = undefined + } $: iconMixin = hierarchy.classHierarchyMixin(value.attachedToClass, view.mixin.ObjectIcon) $: iconMixin && query.query(value.attachedToClass, { _id: value.attachedTo }, (res) => { diff --git a/plugins/notification-resources/src/inboxNotificationsClient.ts b/plugins/notification-resources/src/inboxNotificationsClient.ts index 0248a9bbf4..f03d3a1236 100644 --- a/plugins/notification-resources/src/inboxNotificationsClient.ts +++ b/plugins/notification-resources/src/inboxNotificationsClient.ts @@ -232,6 +232,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient { ) for (const notification of notificationsToRead) { + notification.isViewed = true await client.update(notification, { isViewed: true }) } }