Skip to content

Commit 0c975e8

Browse files
Fix tests and format
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
1 parent 480ccef commit 0c975e8

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

plugins/chunter-resources/src/components/BaseChatScroller.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
export let loadingOverlay: boolean = false
2323
export let onScroll: () => void = () => {}
2424
export let onResize: () => void = () => {}
25+
export let key: string
2526
</script>
2627

2728
{#if loadingOverlay}
@@ -41,7 +42,9 @@
4142
{onScroll}
4243
{onResize}
4344
>
44-
<slot />
45+
{#key key}
46+
<slot />
47+
{/key}
4548
</Scroller>
4649

4750
<style lang="scss">

plugins/chunter-resources/src/components/ReverseChannelScrollView.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@
611611
editLastMessage()
612612
}
613613
}
614+
function getKey (messages: ActivityMessage[]): string {
615+
return `${messages.length}-${Math.max(...messages.map((m) => m.modifiedOn))}`
616+
}
614617
</script>
615618

616619
<div class="flex-col relative" class:h-full={fullHeight}>
@@ -627,6 +630,7 @@
627630
loadingOverlay={$isLoadingStore || !isScrollInitialized}
628631
onScroll={handleScroll}
629632
onResize={handleResize}
633+
key={getKey(messages)}
630634
>
631635
{#if showBlankView}
632636
<BlankView

plugins/inbox-resources/src/components/InboxApplication.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
169169
function isChunterChannel (_class: Ref<Class<Doc>>, urlObjectClass?: Ref<Class<Doc>>): boolean {
170170
const isActivityMessageContext = hierarchy.isDerived(_class, activity.class.ActivityMessage)
171-
const chunterClass = isActivityMessageContext ? urlObjectClass ?? _class : _class
171+
const chunterClass = isActivityMessageContext ? (urlObjectClass ?? _class) : _class
172172
return hierarchy.isDerived(chunterClass, chunter.class.ChunterSpace)
173173
}
174174

plugins/inbox-resources/src/location.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ export async function selectInboxContext (
184184
: undefined
185185
const reactedTo = await client.findOne(activity.class.ActivityMessage, { _id: notification.attachedTo })
186186
const isThread = reactedTo != null && hierarchy.isDerived(reactedTo._class, chunter.class.ThreadMessage)
187-
const channelId = isThread ? (reactedTo as ThreadMessage)?.objectId : reactedTo?.attachedTo ?? objectId
187+
const channelId = isThread ? (reactedTo as ThreadMessage)?.objectId : (reactedTo?.attachedTo ?? objectId)
188188
const channelClass = isThread
189189
? (reactedTo as ThreadMessage)?.objectClass
190-
: reactedTo?.attachedToClass ?? objectClass
190+
: (reactedTo?.attachedToClass ?? objectClass)
191191

192192
void navigateToInboxDoc(
193193
context._id,

plugins/notification-resources/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,10 @@ export async function selectInboxContext (
617617
const thread = loc.path[4] === objectId ? objectId : undefined
618618
const reactedTo = await client.findOne(activity.class.ActivityMessage, { _id: notification.attachedTo })
619619
const isThread = reactedTo != null && hierarchy.isDerived(reactedTo._class, chunter.class.ThreadMessage)
620-
const channelId = isThread ? (reactedTo as ThreadMessage)?.objectId : reactedTo?.attachedTo ?? objectId
620+
const channelId = isThread ? (reactedTo as ThreadMessage)?.objectId : (reactedTo?.attachedTo ?? objectId)
621621
const channelClass = isThread
622622
? (reactedTo as ThreadMessage)?.objectClass
623-
: reactedTo?.attachedToClass ?? objectClass
623+
: (reactedTo?.attachedToClass ?? objectClass)
624624

625625
void navigateToInboxDoc(
626626
linkProviders,

0 commit comments

Comments
 (0)