diff --git a/plugins/chunter-resources/src/components/ChannelScrollView.svelte b/plugins/chunter-resources/src/components/ChannelScrollView.svelte index 30ca4136e3..24af96e288 100644 --- a/plugins/chunter-resources/src/components/ChannelScrollView.svelte +++ b/plugins/chunter-resources/src/components/ChannelScrollView.svelte @@ -557,7 +557,7 @@ const { offsetHeight, scrollHeight, scrollTop } = scrollElement prevScrollHeight = scrollHeight - isScrollAtBottom = scrollHeight === scrollTop + offsetHeight + isScrollAtBottom = scrollHeight <= Math.ceil(scrollTop + offsetHeight) } beforeUpdate(() => { diff --git a/server-plugins/notification-resources/src/index.ts b/server-plugins/notification-resources/src/index.ts index fcf97650c8..47388689e6 100644 --- a/server-plugins/notification-resources/src/index.ts +++ b/server-plugins/notification-resources/src/index.ts @@ -461,6 +461,12 @@ async function activityInboxNotificationToText (doc: Data): Promise { - const persons = await control.findAll(contact.class.Person, { _id: personId }) - if (persons !== undefined && persons.length > 0) { - return persons[0] - } - return undefined -} - export async function shouldNotifyCommon ( control: TriggerControl, user: Ref, @@ -323,18 +315,27 @@ async function getFallbackNotificationFullfillment ( intlParams.title = await textPresenterFunc(object, control) } - const account = control.modelDb.getObject(originTx.modifiedBy) as PersonAccount + const tx = TxProcessor.extractTx(originTx) + const account = control.modelDb.getObject(tx.modifiedBy) as PersonAccount if (account !== undefined) { - const senderPerson = (cache.get(account.person) as Person) ?? (await findPersonForAccount(control, account.person)) - if (senderPerson !== undefined) { - intlParams.senderName = formatName(senderPerson.name, control.branding?.lastNameFirst) - cache.set(senderPerson._id, senderPerson) + const person = + (cache.get(account.person) as Person) ?? (await control.findAll(contact.class.Person, { _id: account.person }))[0] + if (person !== undefined) { + intlParams.senderName = formatName(person.name, control.branding?.lastNameFirst) + cache.set(person._id, person) + } else { + console.error('Cannot find person: ', { accountId: account._id, person: account.person }) } + } else if (tx.modifiedBy === core.account.System) { + intlParams.senderName = await translate(core.string.System, {}) + } else { + console.error('Cannot find person account by _id: ', tx.modifiedBy) } - const actualTx = TxProcessor.extractTx(originTx) - if (actualTx._class === core.class.TxUpdateDoc) { - const updateTx = actualTx as TxUpdateDoc + intlParams.senderName = intlParams.senderName ?? '' + + if (tx._class === core.class.TxUpdateDoc) { + const updateTx = tx as TxUpdateDoc const attributes = control.hierarchy.getAllAttributes(object._class) for (const attrName in updateTx.operations) { if (!Object.prototype.hasOwnProperty.call(updateTx.operations, attrName)) {