Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
defer navigation display until user promise is fulfilled
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinansfield authored and acburdine committed Feb 1, 2017
1 parent 51f444c commit 791a819
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ export default Controller.extend({
dropdown: injectService(),
session: injectService(),

showNavMenu: computed('currentPath', 'session.isAuthenticated', function () {
showNavMenu: computed('currentPath', 'session.isAuthenticated', 'session.user.isFulfilled', function () {
// we need to defer showing the navigation menu until the session.user
// promise has fulfilled so that gh-user-can-admin has the correct data
if (!this.get('session.isAuthenticated') || !this.get('session.user.isFulfilled')) {
return false;
}

return (this.get('currentPath') !== 'error404' || this.get('session.isAuthenticated'))
&& !this.get('currentPath').match(/(signin|signup|setup|reset)/);
}),
Expand Down

0 comments on commit 791a819

Please sign in to comment.