forked from mystiq/hydrogen-web
pass log item everywhere to tryInsert
This commit is contained in:
parent
b58e10521f
commit
ac5a4c2bc6
4 changed files with 12 additions and 12 deletions
|
@ -247,8 +247,8 @@ export function tests() {
|
||||||
storage.storeNames.timelineFragments
|
storage.storeNames.timelineFragments
|
||||||
]);
|
]);
|
||||||
txn.timelineFragments.add({id: 1, roomId});
|
txn.timelineFragments.add({id: 1, roomId});
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event: messageEvent, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event: messageEvent, roomId}, new NullLogItem());
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 3, event: myReactionEvent, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 3, event: myReactionEvent, roomId}, new NullLogItem());
|
||||||
await relationWriter.writeRelation(myReactionEntry, txn, new NullLogItem());
|
await relationWriter.writeRelation(myReactionEntry, txn, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
// 2. setup queue & timeline
|
// 2. setup queue & timeline
|
||||||
|
@ -309,7 +309,7 @@ export function tests() {
|
||||||
storage.storeNames.timelineFragments
|
storage.storeNames.timelineFragments
|
||||||
]);
|
]);
|
||||||
txn.timelineFragments.add({id: 1, roomId});
|
txn.timelineFragments.add({id: 1, roomId});
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event: messageEvent, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event: messageEvent, roomId}, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
// 2. setup queue & timeline
|
// 2. setup queue & timeline
|
||||||
const queue = new SendQueue({roomId, storage, hsApi: new MockHomeServer().api});
|
const queue = new SendQueue({roomId, storage, hsApi: new MockHomeServer().api});
|
||||||
|
|
|
@ -450,7 +450,7 @@ export function tests() {
|
||||||
txn.timelineEvents.tryInsert({
|
txn.timelineEvents.tryInsert({
|
||||||
event: withContent(createAnnotation(messageId, "👋"), createEvent("m.reaction", reactionId, bob)),
|
event: withContent(createAnnotation(messageId, "👋"), createEvent("m.reaction", reactionId, bob)),
|
||||||
fragmentId: 1, eventIndex: 1, roomId
|
fragmentId: 1, eventIndex: 1, roomId
|
||||||
});
|
}, new NullLogItem());
|
||||||
txn.timelineRelations.add(roomId, messageId, ANNOTATION_RELATION_TYPE, reactionId);
|
txn.timelineRelations.add(roomId, messageId, ANNOTATION_RELATION_TYPE, reactionId);
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
// 2. setup the timeline
|
// 2. setup the timeline
|
||||||
|
@ -546,7 +546,7 @@ export function tests() {
|
||||||
txn.timelineEvents.tryInsert({
|
txn.timelineEvents.tryInsert({
|
||||||
event: withContent(createAnnotation(messageId, "👋"), createEvent("m.reaction", reactionId, bob)),
|
event: withContent(createAnnotation(messageId, "👋"), createEvent("m.reaction", reactionId, bob)),
|
||||||
fragmentId: 1, eventIndex: 3, roomId
|
fragmentId: 1, eventIndex: 3, roomId
|
||||||
});
|
}, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
// 2. setup timeline
|
// 2. setup timeline
|
||||||
const pendingEvents = new ObservableArray();
|
const pendingEvents = new ObservableArray();
|
||||||
|
|
|
@ -124,7 +124,7 @@ export class GapWriter {
|
||||||
if (updatedRelationTargetEntries) {
|
if (updatedRelationTargetEntries) {
|
||||||
updatedEntries.push(...updatedRelationTargetEntries);
|
updatedEntries.push(...updatedRelationTargetEntries);
|
||||||
}
|
}
|
||||||
if (await txn.timelineEvents.tryInsert(eventStorageEntry)) {
|
if (await txn.timelineEvents.tryInsert(eventStorageEntry, log)) {
|
||||||
const eventEntry = new EventEntry(eventStorageEntry, this._fragmentIdComparer);
|
const eventEntry = new EventEntry(eventStorageEntry, this._fragmentIdComparer);
|
||||||
directionalAppend(entries, eventEntry, direction);
|
directionalAppend(entries, eventEntry, direction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ export function tests() {
|
||||||
|
|
||||||
const storage = await createMockStorage();
|
const storage = await createMockStorage();
|
||||||
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId}, new NullLogItem());
|
||||||
const updatedEntries = await relationWriter.writeRelation(redactionEntry, txn, new NullLogItem());
|
const updatedEntries = await relationWriter.writeRelation(redactionEntry, txn, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ export function tests() {
|
||||||
|
|
||||||
const storage = await createMockStorage();
|
const storage = await createMockStorage();
|
||||||
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId}, new NullLogItem());
|
||||||
const updatedEntries = await relationWriter.writeRelation(reactionEntry, txn, new NullLogItem());
|
const updatedEntries = await relationWriter.writeRelation(reactionEntry, txn, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ export function tests() {
|
||||||
|
|
||||||
const storage = await createMockStorage();
|
const storage = await createMockStorage();
|
||||||
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId}, new NullLogItem());
|
||||||
await relationWriter.writeRelation(reaction1Entry, txn, new NullLogItem());
|
await relationWriter.writeRelation(reaction1Entry, txn, new NullLogItem());
|
||||||
const updatedEntries = await relationWriter.writeRelation(reaction2Entry, txn, new NullLogItem());
|
const updatedEntries = await relationWriter.writeRelation(reaction2Entry, txn, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
|
@ -358,10 +358,10 @@ export function tests() {
|
||||||
|
|
||||||
const storage = await createMockStorage();
|
const storage = await createMockStorage();
|
||||||
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents, storage.storeNames.timelineRelations]);
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 2, event, roomId}, new NullLogItem());
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 3, event: myReaction, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 3, event: myReaction, roomId}, new NullLogItem());
|
||||||
await relationWriter.writeRelation(myReactionEntry, txn, new NullLogItem());
|
await relationWriter.writeRelation(myReactionEntry, txn, new NullLogItem());
|
||||||
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 4, event: bobReaction, roomId});
|
txn.timelineEvents.tryInsert({fragmentId: 1, eventIndex: 4, event: bobReaction, roomId}, new NullLogItem());
|
||||||
await relationWriter.writeRelation(bobReactionEntry, txn, new NullLogItem());
|
await relationWriter.writeRelation(bobReactionEntry, txn, new NullLogItem());
|
||||||
const updatedEntries = await relationWriter.writeRelation(myReactionRedactionEntry, txn, new NullLogItem());
|
const updatedEntries = await relationWriter.writeRelation(myReactionRedactionEntry, txn, new NullLogItem());
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
|
|
Loading…
Reference in a new issue