1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-13 07:42:14 +03:00

Fix RoomHierarchy comments

This commit is contained in:
Michael Telatynski
2021-08-11 20:57:40 +01:00
parent db212a555d
commit fc78e63ad1

View File

@@ -36,22 +36,9 @@ export class RoomHierarchy {
private serverSupportError?: Error; private serverSupportError?: Error;
/** /**
* Construct a new EventTimeline * Construct a new RoomHierarchy
* *
* TODO * A RoomHierarchy instance allows you to easily make use of the /hierarchy API and paginate it.
* <p>An EventTimeline represents a contiguous sequence of events in a room.
*
* <p>As well as keeping track of the events themselves, it stores the state of
* the room at the beginning and end of the timeline, and pagination tokens for
* going backwards and forwards in the timeline.
*
* <p>In order that clients can meaningfully maintain an index into a timeline,
* the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is
* incremented when events are prepended to the timeline. The index of an event
* relative to baseIndex therefore remains constant.
*
* <p>Once a timeline joins up with its neighbour, they are linked together into a
* doubly-linked list.
* *
* @param {Room} root the root of this hierarchy * @param {Room} root the root of this hierarchy
* @param {number} pageSize the maximum number of rooms to return per page, can be overridden per load request. * @param {number} pageSize the maximum number of rooms to return per page, can be overridden per load request.
@@ -96,7 +83,7 @@ export class RoomHierarchy {
if (e.errcode === "M_UNRECOGNIZED") { if (e.errcode === "M_UNRECOGNIZED") {
this.serverSupportError = e; this.serverSupportError = e;
} else { } else {
// TODO retry? throw e;
} }
return []; return [];
@@ -145,6 +132,7 @@ export class RoomHierarchy {
return this.getRelation(parentId, childId)?.content.suggested; return this.getRelation(parentId, childId)?.content.suggested;
} }
// locally remove a relation as a form of local echo
public removeRelation(parentId: string, childId: string): void { public removeRelation(parentId: string, childId: string): void {
const backRefs = this.backRefs.get(childId); const backRefs = this.backRefs.get(childId);
if (backRefs?.length === 1) { if (backRefs?.length === 1) {