If public room creation fails, retry without publishing it (#19194)
Signed-off-by: Andrew Ferrazzutti <fair@miscworks.net>
This commit is contained in:
parent
8e497f8c56
commit
cd8a0b8aec
1 changed files with 8 additions and 0 deletions
|
@ -221,6 +221,14 @@ export default async function createRoom(opts: IOpts): Promise<string | null> {
|
||||||
let roomId;
|
let roomId;
|
||||||
return client.createRoom(createOpts).finally(function() {
|
return client.createRoom(createOpts).finally(function() {
|
||||||
if (modal) modal.close();
|
if (modal) modal.close();
|
||||||
|
}).catch(function(err) {
|
||||||
|
if (err.httpStatus === 403 && err.errcode == "M_UNKNOWN") {
|
||||||
|
console.warn("Failed to publish room, try again without publishing it");
|
||||||
|
createOpts.visibility = Visibility.Private;
|
||||||
|
return client.createRoom(createOpts);
|
||||||
|
} else {
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
}).then(function(res) {
|
}).then(function(res) {
|
||||||
roomId = res.room_id;
|
roomId = res.room_id;
|
||||||
if (opts.dmUserId) {
|
if (opts.dmUserId) {
|
||||||
|
|
Loading…
Reference in a new issue