mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
fix lint
This commit is contained in:
parent
826de7e9cb
commit
a61f052fe8
@ -191,32 +191,6 @@ export function tests() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRoomResponse(stateEvents, timelineEvents) {
|
|
||||||
if (!Array.isArray(timelineEvents)) {
|
|
||||||
timelineEvents = [timelineEvents];
|
|
||||||
}
|
|
||||||
if (!Array.isArray(stateEvents)) {
|
|
||||||
stateEvents = [stateEvents];
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
timeline: {
|
|
||||||
limited: false,
|
|
||||||
events: timelineEvents,
|
|
||||||
},
|
|
||||||
state: {
|
|
||||||
events: stateEvents
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function createTimelineResponse(timelineEvents) {
|
|
||||||
return createRoomResponse([], timelineEvents)
|
|
||||||
}
|
|
||||||
|
|
||||||
function createStateReponse(stateEvents) {
|
|
||||||
return createRoomResponse(stateEvents, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createStorage(initialMembers = []) {
|
function createStorage(initialMembers = []) {
|
||||||
const members = new Map();
|
const members = new Map();
|
||||||
for (const m of initialMembers) {
|
for (const m of initialMembers) {
|
||||||
|
@ -149,6 +149,7 @@ export class SyncWriter {
|
|||||||
const entries = [];
|
const entries = [];
|
||||||
const updatedEntries = [];
|
const updatedEntries = [];
|
||||||
// only create a fragment when we will really write an event
|
// only create a fragment when we will really write an event
|
||||||
|
if (timelineEvents?.length) {
|
||||||
currentKey = await this._ensureLiveFragment(currentKey, entries, timeline, txn, log);
|
currentKey = await this._ensureLiveFragment(currentKey, entries, timeline, txn, log);
|
||||||
log.set("timelineEvents", timelineEvents.length);
|
log.set("timelineEvents", timelineEvents.length);
|
||||||
let timelineStateEventCount = 0;
|
let timelineStateEventCount = 0;
|
||||||
@ -178,6 +179,7 @@ export class SyncWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.set("timelineStateEventCount", timelineStateEventCount);
|
log.set("timelineStateEventCount", timelineStateEventCount);
|
||||||
|
}
|
||||||
return {currentKey, entries, updatedEntries};
|
return {currentKey, entries, updatedEntries};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,10 +238,8 @@ export class SyncWriter {
|
|||||||
if (stateEvents) {
|
if (stateEvents) {
|
||||||
await this._writeStateEvents(roomResponse, txn, log);
|
await this._writeStateEvents(roomResponse, txn, log);
|
||||||
}
|
}
|
||||||
if (timelineEvents?.length) {
|
|
||||||
const {currentKey, entries, updatedEntries} =
|
const {currentKey, entries, updatedEntries} =
|
||||||
await this._writeTimeline(timelineEvents, timeline, memberSync, this._lastLiveKey, txn, log);
|
await this._writeTimeline(timelineEvents, timeline, memberSync, this._lastLiveKey, txn, log);
|
||||||
}
|
|
||||||
const memberChanges = await memberSync.write(txn);
|
const memberChanges = await memberSync.write(txn);
|
||||||
return {entries, updatedEntries, newLiveKey: currentKey, memberChanges};
|
return {entries, updatedEntries, newLiveKey: currentKey, memberChanges};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user