Fixed scroll to new messages on chat open (#5369)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2024-04-16 17:26:39 +07:00
committed by GitHub
parent d81f91fc3b
commit 84de2c1931
11 changed files with 98 additions and 51 deletions
+12 -10
View File
@@ -432,6 +432,16 @@ async function OnChannelMembersChanged (tx: TxUpdateDoc<Channel>, control: Trigg
)
}
if (added.length > 0) {
res.push(
control.txFactory.createTxMixin(tx.objectId, tx.objectClass, tx.objectSpace, notification.mixin.Collaborators, {
$push: {
collaborators: { $each: added, $position: 0 }
}
})
)
}
for (const addedMember of added) {
const context = allContexts.find(({ user }) => user === addedMember)
@@ -457,16 +467,8 @@ async function OnChannelMembersChanged (tx: TxUpdateDoc<Channel>, control: Trigg
const contextsToRemove = allContexts.filter(({ user }) => removed.includes(user))
if (contextsToRemove.length === 0) {
return res
}
const channel = (await control.findAll(chunter.class.Channel, { _id: tx.objectId }))[0]
if (channel !== undefined) {
for (const context of contextsToRemove) {
res.push(control.txFactory.createTxRemoveDoc(context._class, context.space, context._id))
}
for (const context of contextsToRemove) {
res.push(control.txFactory.createTxRemoveDoc(context._class, context.space, context._id))
}
return res