From 017b2e0444210f1d47e0720af8b21805a62b7454 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Fri, 1 Oct 2021 01:42:25 -0400 Subject: [PATCH] Comment that the room publish failure check is Synapse-specific Signed-off-by: Andrew Ferrazzutti --- src/createRoom.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/createRoom.ts b/src/createRoom.ts index 0d8172c558..7f915bd051 100644 --- a/src/createRoom.ts +++ b/src/createRoom.ts @@ -222,6 +222,10 @@ export default async function createRoom(opts: IOpts): Promise { return client.createRoom(createOpts).finally(function() { if (modal) modal.close(); }).catch(function(err) { + // NB This checks for the Synapse-specific error condition of a room creation + // having been denied because the requesting user wanted to publish the room, + // but the server denies them that permission (via room_list_publication_rules). + // The check below responds by retrying without publishing the room. if (err.httpStatus === 403 && err.errcode === "M_UNKNOWN" && err.data.error === "Not allowed to publish room") { console.warn("Failed to publish room, try again without publishing it"); createOpts.visibility = Visibility.Private;