Clear outstanding TODOs

This commit is contained in:
Michael Telatynski 2021-06-15 08:26:46 +01:00
parent b9f86d54c3
commit a63d9220d2
2 changed files with 11 additions and 8 deletions

View file

@ -634,9 +634,16 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
return sortBy(spaces, [this.getSpaceTagOrdering, "roomId"]);
}
private setRootSpaceOrder(space: Room, order: string): void {
private async setRootSpaceOrder(space: Room, order: string): Promise<void> {
this.spaceOrderLocalEchoMap.set(space.roomId, order);
this.matrixClient.setRoomAccountData(space.roomId, EventType.SpaceOrder, { order }); // TODO retrying, failure
try {
await this.matrixClient.setRoomAccountData(space.roomId, EventType.SpaceOrder, { order });
} catch (e) {
console.log("Failed to set root space order", e);
if (this.spaceOrderLocalEchoMap.get(space.roomId) === order) {
this.spaceOrderLocalEchoMap.delete(space.roomId);
}
}
}
public moveRootSpace(fromIndex: number, toIndex: number): void {
@ -647,11 +654,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
this.setRootSpaceOrder(this.rootSpaces[index], order);
});
if (changes.length) {
this.notifyIfOrderChanged();
} else {
// TODO
}
this.notifyIfOrderChanged();
}
}

View file

@ -67,7 +67,7 @@ describe("stringOrderField", () => {
expect(baseToString(BigInt(6241))).toEqual("`a");
expect(baseToString(BigInt(53), "abcdefghijklmnopqrstuvwxyz")).toEqual("ba");
expect(baseToString(BigInt(1234))).toBe("+}");
expect(baseToString(BigInt(0))).toBe(""); // TODO
expect(baseToString(BigInt(0))).toBe("");
expect(baseToString(BigInt(1))).toBe(" ");
expect(baseToString(BigInt(95))).toBe("~");
expect(baseToString(BigInt(96))).toBe(" ");