mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Add experimental code to fetch an event's context
This commit is contained in:
parent
299abe3e7e
commit
8592fcf8c7
@ -110,6 +110,18 @@ export class Room extends BaseRoom {
|
||||
}
|
||||
}
|
||||
|
||||
async fetchContext(eventId, log = null) {
|
||||
const response = await this._hsApi.context(this._roomId, eventId, {}, {log}).response();
|
||||
await this._fetchEvents(response, async (txn, gapWriter) => {
|
||||
// Just in case we somehow receive remote echoes during event fetch
|
||||
const beforeExtra = await this._writeGapFill(response.events_before, txn, log);
|
||||
const afterExtra = await this._writeGapFill(response.events_after, txn, log);
|
||||
beforeExtra.append(...afterExtra);
|
||||
const gapResult = await gapWriter.writeContext(response, txn, log);
|
||||
return { extraGapFillChanges: beforeExtra, gapResult };
|
||||
}, log);
|
||||
}
|
||||
|
||||
/** @package */
|
||||
async writeSync(roomResponse, isInitialSync, {summaryChanges, decryptChanges, roomEncryption, retryEntries}, txn, log) {
|
||||
log.set("id", this.id);
|
||||
|
Loading…
Reference in New Issue
Block a user