mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 04:49:00 +00:00
Fix activity for attached documents (#1115)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
1647ca4741
commit
178105c657
@ -53,6 +53,7 @@ export interface DisplayTx {
|
||||
|
||||
// A set of collapsed transactions.
|
||||
txes: DisplayTx[]
|
||||
txDocIds?: Set<Ref<Doc>>
|
||||
|
||||
// type check for createTx
|
||||
createTx?: TxCreateDoc<Doc>
|
||||
@ -314,6 +315,15 @@ class ActivityImpl implements Activity {
|
||||
if (result.tx.modifiedOn - prevTx.tx.modifiedOn < combineThreshold && isEqualOps(prevUpdate, curUpdate)) {
|
||||
// we have same keys,
|
||||
// Remember previous transactions
|
||||
if (result.txDocIds === undefined) {
|
||||
result.txDocIds = new Set()
|
||||
}
|
||||
if (prevTx.doc?._id !== undefined) {
|
||||
result.txDocIds?.add(prevTx.doc._id)
|
||||
}
|
||||
if (result.doc?._id !== undefined) {
|
||||
result.txDocIds?.add(result.doc._id)
|
||||
}
|
||||
result.txes.push(...prevTx.txes, prevTx)
|
||||
return false
|
||||
}
|
||||
@ -343,7 +353,7 @@ function getCombineOpFromTx (result: DisplayTx): any {
|
||||
if (result.tx._class === core.class.TxMixin) {
|
||||
curUpdate = (result.tx as unknown as TxMixin<Doc, Doc>).attributes
|
||||
}
|
||||
if (result.collectionAttribute !== undefined) {
|
||||
if (curUpdate === undefined && result.collectionAttribute !== undefined) {
|
||||
curUpdate = result.collectionAttribute.attributeOf + '.' + result.collectionAttribute.name
|
||||
}
|
||||
return curUpdate
|
||||
|
@ -217,7 +217,7 @@
|
||||
{/await}
|
||||
{/each}
|
||||
{:else if viewlet && viewlet.display === 'inline' && viewlet.component}
|
||||
{#if tx.collectionAttribute !== undefined && tx.txes.length > 0}
|
||||
{#if tx.collectionAttribute !== undefined && (tx.txDocIds?.size ?? 0) > 1}
|
||||
<ShowMore ignore={edit}>
|
||||
<div class="flex-row-center flex-grow flex-wrap">
|
||||
<TxViewTx {tx} {onCancelEdit} {edit} {viewlet}/>
|
||||
@ -240,11 +240,11 @@
|
||||
{#if viewlet && viewlet.component && viewlet.display !== 'inline'}
|
||||
<div class={viewlet.display}>
|
||||
<ShowMore ignore={edit}>
|
||||
{#if tx.collectionAttribute !== undefined && tx.txes.length > 0}
|
||||
{#if tx.collectionAttribute !== undefined && (tx.txDocIds?.size ?? 0) > 1}
|
||||
<div class="flex-row-center flex-grow flex-wrap">
|
||||
<TxViewTx {tx} {onCancelEdit} {edit} {viewlet}/>
|
||||
</div>
|
||||
{:else}
|
||||
{:else}
|
||||
{#if typeof viewlet.component === 'string'}
|
||||
<Component is={viewlet.component} {props} on:close={onCancelEdit} />
|
||||
{:else}
|
||||
|
@ -89,7 +89,7 @@ async function checkInlineViewlets (
|
||||
client: TxOperations,
|
||||
model: AttributeModel[]
|
||||
): Promise<{ viewlet: TxDisplayViewlet, model: AttributeModel[] }> {
|
||||
if (dtx.collectionAttribute !== undefined && dtx.txes.length > 0) {
|
||||
if (dtx.collectionAttribute !== undefined && (dtx.txDocIds?.size ?? 0) > 1) {
|
||||
// Check if we have a class presenter we could have a pseudo viewlet based on class presenter.
|
||||
viewlet = await createPseudoViewlet(client, dtx, activity.string.CollectionUpdated, 'content')
|
||||
} else if (dtx.tx._class === core.class.TxCreateDoc) {
|
||||
|
Loading…
Reference in New Issue
Block a user