From 4bdc997cabc2f36ff647a950bd81976fa7f09bc0 Mon Sep 17 00:00:00 2001 From: ThomasRoehl Date: Thu, 15 Mar 2018 15:49:23 +0100 Subject: [PATCH] Fix creation dialog for custom room types not appearing ... when opening the `/create-channel`-URL --- package-lock.json | 2 +- .../client/views/app/createRooms.html | 17 +++++++++-------- .../client/views/app/createRooms.js | 17 ++++++++++++++--- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e0ada538038..6c6751ba8fde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4184,7 +4184,7 @@ }, "fibers": { "version": "1.0.15", - "resolved": "http://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", + "resolved": "https://registry.npmjs.org/fibers/-/fibers-1.0.15.tgz", "integrity": "sha1-IvA5yPGLhWGQ+75N7PBWFUwerpw=", "dev": true }, diff --git a/packages/rocketchat-ui/client/views/app/createRooms.html b/packages/rocketchat-ui/client/views/app/createRooms.html index a50b722c885f..828b55a960df 100644 --- a/packages/rocketchat-ui/client/views/app/createRooms.html +++ b/packages/rocketchat-ui/client/views/app/createRooms.html @@ -1,10 +1,11 @@ diff --git a/packages/rocketchat-ui/client/views/app/createRooms.js b/packages/rocketchat-ui/client/views/app/createRooms.js index f3b7fc460c88..905ef9297fe6 100644 --- a/packages/rocketchat-ui/client/views/app/createRooms.js +++ b/packages/rocketchat-ui/client/views/app/createRooms.js @@ -39,11 +39,22 @@ Template.createRooms.helpers({ tabsNeeded() { const instance = Template.instance(); return !!(instance.data.roomTypesBeforeStandard.length || instance.data.roomTypesAfterStandard.length); + }, + + authorizationsLoaded() { + return RocketChat.authz.cachedCollection.ready.get(); } }); Template.createRooms.onCreated(function() { - this.data.roomTypesBeforeStandard = roomTypesBeforeStandard(); - this.data.roomTypesAfterStandard = roomTypesAfterStandard(); - this.data.tabs = allTemplatesOrdered(); + Tracker.autorun(()=> { + const authLoaded = RocketChat.authz.cachedCollection.ready.get(); + if (authLoaded) { + // custom room types might verify authorization before they decide to be visible. + // This is only possible once the authorizations, which are a cached collection, are loaded + this.data.roomTypesBeforeStandard = roomTypesBeforeStandard(); + this.data.roomTypesAfterStandard = roomTypesAfterStandard(); + } + this.data.tabs = allTemplatesOrdered(); + }); });