iterate PR

This commit is contained in:
Michael Telatynski 2021-06-16 09:23:06 +01:00
parent a63d9220d2
commit cee294f5a7
6 changed files with 34 additions and 35 deletions

View file

@ -62,14 +62,13 @@ const partitionSpacesAndRooms = (arr: Room[]): [Room[], Room[]] => { // [spaces,
}, [[], []]);
};
const validOrder = (order: string): string | null => {
const validOrder = (order: string): string | undefined => {
if (typeof order === "string" && order.length <= 50 && Array.from(order).every((c: string) => {
const charCode = c.charCodeAt(0);
return charCode >= 0x20 && charCode <= 0x7E;
})) {
return order;
}
return undefined;
};
// For sorting space children using a validated `order`, `m.room.create`'s `origin_server_ts`, `room_id`
@ -639,7 +638,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
try {
await this.matrixClient.setRoomAccountData(space.roomId, EventType.SpaceOrder, { order });
} catch (e) {
console.log("Failed to set root space order", e);
console.warn("Failed to set root space order", e);
if (this.spaceOrderLocalEchoMap.get(space.roomId) === order) {
this.spaceOrderLocalEchoMap.delete(space.roomId);
}