mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-07 00:09:34 +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.
|
// A set of collapsed transactions.
|
||||||
txes: DisplayTx[]
|
txes: DisplayTx[]
|
||||||
|
txDocIds?: Set<Ref<Doc>>
|
||||||
|
|
||||||
// type check for createTx
|
// type check for createTx
|
||||||
createTx?: TxCreateDoc<Doc>
|
createTx?: TxCreateDoc<Doc>
|
||||||
@ -314,6 +315,15 @@ class ActivityImpl implements Activity {
|
|||||||
if (result.tx.modifiedOn - prevTx.tx.modifiedOn < combineThreshold && isEqualOps(prevUpdate, curUpdate)) {
|
if (result.tx.modifiedOn - prevTx.tx.modifiedOn < combineThreshold && isEqualOps(prevUpdate, curUpdate)) {
|
||||||
// we have same keys,
|
// we have same keys,
|
||||||
// Remember previous transactions
|
// 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)
|
result.txes.push(...prevTx.txes, prevTx)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -343,7 +353,7 @@ function getCombineOpFromTx (result: DisplayTx): any {
|
|||||||
if (result.tx._class === core.class.TxMixin) {
|
if (result.tx._class === core.class.TxMixin) {
|
||||||
curUpdate = (result.tx as unknown as TxMixin<Doc, Doc>).attributes
|
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
|
curUpdate = result.collectionAttribute.attributeOf + '.' + result.collectionAttribute.name
|
||||||
}
|
}
|
||||||
return curUpdate
|
return curUpdate
|
||||||
|
@ -217,7 +217,7 @@
|
|||||||
{/await}
|
{/await}
|
||||||
{/each}
|
{/each}
|
||||||
{:else if viewlet && viewlet.display === 'inline' && viewlet.component}
|
{: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}>
|
<ShowMore ignore={edit}>
|
||||||
<div class="flex-row-center flex-grow flex-wrap">
|
<div class="flex-row-center flex-grow flex-wrap">
|
||||||
<TxViewTx {tx} {onCancelEdit} {edit} {viewlet}/>
|
<TxViewTx {tx} {onCancelEdit} {edit} {viewlet}/>
|
||||||
@ -240,11 +240,11 @@
|
|||||||
{#if viewlet && viewlet.component && viewlet.display !== 'inline'}
|
{#if viewlet && viewlet.component && viewlet.display !== 'inline'}
|
||||||
<div class={viewlet.display}>
|
<div class={viewlet.display}>
|
||||||
<ShowMore ignore={edit}>
|
<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">
|
<div class="flex-row-center flex-grow flex-wrap">
|
||||||
<TxViewTx {tx} {onCancelEdit} {edit} {viewlet}/>
|
<TxViewTx {tx} {onCancelEdit} {edit} {viewlet}/>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
{#if typeof viewlet.component === 'string'}
|
{#if typeof viewlet.component === 'string'}
|
||||||
<Component is={viewlet.component} {props} on:close={onCancelEdit} />
|
<Component is={viewlet.component} {props} on:close={onCancelEdit} />
|
||||||
{:else}
|
{:else}
|
||||||
|
@ -89,7 +89,7 @@ async function checkInlineViewlets (
|
|||||||
client: TxOperations,
|
client: TxOperations,
|
||||||
model: AttributeModel[]
|
model: AttributeModel[]
|
||||||
): Promise<{ viewlet: TxDisplayViewlet, 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.
|
// 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')
|
viewlet = await createPseudoViewlet(client, dtx, activity.string.CollectionUpdated, 'content')
|
||||||
} else if (dtx.tx._class === core.class.TxCreateDoc) {
|
} else if (dtx.tx._class === core.class.TxCreateDoc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user