mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 04:49:00 +00:00
UBER-902: Fix transactions (#3748)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
41e5e047d9
commit
f0112d06bd
@ -237,6 +237,21 @@ export class TxOperations implements Omit<Client, 'notify'> {
|
||||
if (hierarchy.isMixin(it[0])) {
|
||||
await ops.updateMixin(doc._id, baseClass, doc.space, it[0], it[1], modifiedOn, modifiedBy)
|
||||
} else {
|
||||
if (hierarchy.isDerived(it[0], core.class.AttachedDoc)) {
|
||||
const adoc = doc as unknown as AttachedDoc
|
||||
return await this.updateCollection(
|
||||
it[0],
|
||||
doc.space,
|
||||
adoc._id,
|
||||
adoc.attachedTo,
|
||||
adoc.attachedToClass,
|
||||
adoc.collection,
|
||||
it[1],
|
||||
retrieve,
|
||||
modifiedOn,
|
||||
modifiedBy
|
||||
)
|
||||
}
|
||||
await ops.updateDoc(it[0], doc.space, doc._id, it[1], retrieve, modifiedOn, modifiedBy)
|
||||
}
|
||||
}
|
||||
|
@ -428,8 +428,19 @@ async function isShouldNotify (
|
||||
let allowed = false
|
||||
const emailTypes: NotificationType[] = []
|
||||
const types = await getMatchedTypes(control, tx, originTx, isOwn, isSpace)
|
||||
|
||||
const personAccount = await getPersonAccountById(user, control)
|
||||
|
||||
for (const type of types) {
|
||||
if (type.allowedForAuthor !== true && tx.modifiedBy === user) continue
|
||||
const modifiedAccount = await getPersonAccountById(tx.modifiedBy, control)
|
||||
if (
|
||||
type.allowedForAuthor !== true &&
|
||||
(tx.modifiedBy === user ||
|
||||
// Also check if we have different account for same user.
|
||||
(personAccount?.person !== undefined && personAccount?.person === modifiedAccount?.person))
|
||||
) {
|
||||
continue
|
||||
}
|
||||
if (control.hierarchy.hasMixin(type, serverNotification.mixin.TypeMatch)) {
|
||||
const mixin = control.hierarchy.as(type, serverNotification.mixin.TypeMatch)
|
||||
if (mixin.func !== undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user