Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Comment that the room publish failure check is Synapse-specific
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Ferrazzutti <fair@miscworks.net>
  • Loading branch information
AndrewFerr committed Oct 3, 2021
1 parent d4326c9 commit d9e9dca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/createRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ export default async function createRoom(opts: IOpts): Promise<string | null> {
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;
Expand Down

0 comments on commit d9e9dca

Please sign in to comment.