Skip to content

Commit

Permalink
Fix creation dialog for custom room types not appearing
Browse files Browse the repository at this point in the history
... when opening the `/create-channel`-URL
  • Loading branch information
ThomasRoehl committed Mar 15, 2018
1 parent 837ef5e commit 4bdc997
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions packages/rocketchat-ui/client/views/app/createRooms.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<template name="createRooms">
<section class="create-channel">
{{#if tabsNeeded }}
{{> tabContainer tabs=tabs}}
{{else}}
{{> createChannel }}
{{/if}}
</section>

{{#if authorizationsLoaded }}
<section class="create-channel">
{{#if tabsNeeded }}
{{> tabContainer tabs=tabs}}
{{else}}
{{> createChannel }}
{{/if}}
</section>
{{/if}}
</template>
17 changes: 14 additions & 3 deletions packages/rocketchat-ui/client/views/app/createRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

0 comments on commit 4bdc997

Please sign in to comment.