fix some tests, implement event classes for types, and re-implement logging

This commit is contained in:
Kevin Jahns
2017-10-22 19:12:50 +02:00
parent 755c9eb16e
commit c92f987496
17 changed files with 235 additions and 259 deletions

View File

@@ -2,6 +2,7 @@ import { getReference } from '../Util/structReferences.js'
import ID from '../Util/ID.js'
import { RootFakeUserID } from '../Util/RootID.js'
import Delete from './Delete.js'
import { transactionTypeChanged } from '../Transaction.js'
/**
* Helper utility to split an Item (see _splitAt)
@@ -64,10 +65,7 @@ export default class Item {
del._length = this._length
del._integrate(y, true)
}
const parent = this._parent
if (parent !== y && !parent._deleted) {
y._transactionChangedTypes.set(parent, this._parentSub)
}
transactionTypeChanged(y, this._parent, this._parentSub)
}
/**
* This is called right before this struct receives any children.
@@ -98,7 +96,7 @@ export default class Item {
// missing content from user
throw new Error('Can not apply yet!')
}
if (!parent._deleted && !y._transactionChangedTypes.has(parent) && !y._transactionNewTypes.has(parent)) {
if (!parent._deleted && !y._transaction.changedTypes.has(parent) && !y._transaction.newTypes.has(parent)) {
// this is the first time parent is updated
// or this types is new
this._parent._beforeChange()
@@ -178,10 +176,7 @@ export default class Item {
}
}
y.os.put(this)
if (parent !== y && !parent._deleted) {
y._transactionChangedTypes.set(parent, parentSub)
}
transactionTypeChanged(y, parent, parentSub)
if (this._id.user !== RootFakeUserID) {
if (y.connector._forwardAppliedStructs || this._id.user === y.userID) {
y.connector.broadcastStruct(this)