diff --git a/app/coffee/modules/common/lightboxes.coffee b/app/coffee/modules/common/lightboxes.coffee index 00a1c86e..dfe51dc2 100644 --- a/app/coffee/modules/common/lightboxes.coffee +++ b/app/coffee/modules/common/lightboxes.coffee @@ -79,7 +79,7 @@ class LightboxService extends taiga.Service if $el.hasClass("remove-on-close") scope = $el.data("scope") - scope.$destroy() + scope.$destroy() if scope $el.remove() closeAll: -> diff --git a/app/coffee/modules/projects/lightboxes.coffee b/app/coffee/modules/projects/lightboxes.coffee index 774bb866..eca7121f 100644 --- a/app/coffee/modules/projects/lightboxes.coffee +++ b/app/coffee/modules/projects/lightboxes.coffee @@ -35,10 +35,6 @@ CreateProject = ($rootscope, $repo, $confirm, $location, $navurls, $rs, $project $scope.templates = [] currentLoading = null - $auth.refresh() - $scope.canCreatePrivateProjects = currentUserService.canCreatePrivateProjects() - $scope.canCreatePublicProjects = currentUserService.canCreatePublicProjects() - form = $el.find("form").checksley({"onlyOneErrorElement": true}) onSuccessSubmit = (response) -> @@ -88,6 +84,9 @@ CreateProject = ($rootscope, $repo, $confirm, $location, $navurls, $rs, $project else $scope.data.creation_template = _.head(_.filter($scope.templates, (x) -> x.slug == "scrum")).id + $scope.canCreatePrivateProjects = currentUserService.canCreatePrivateProjects() + $scope.canCreatePublicProjects = currentUserService.canCreatePublicProjects() + lightboxService.open($el) submitButton = $el.find(".submit-button") @@ -101,7 +100,8 @@ CreateProject = ($rootscope, $repo, $confirm, $location, $navurls, $rs, $project $scope.$on "$destroy", -> $el.off() - openLightbox() + $auth.refresh().then () -> + openLightbox() directive = { link: link,