From 606eed0528d7bfc8335c17ad1aa10e16d5b7d66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Fri, 23 Nov 2018 13:17:37 +0100 Subject: [PATCH] Avoid redirect on navigation --- app/coffee/app.coffee | 1 + app/coffee/modules/base/navurls.coffee | 2 +- app/coffee/modules/common/sections.coffee | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index adcafa9c..7ba2535f 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -871,6 +871,7 @@ init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $na errorHandlingService.init() if projectService.project?.get('blocked_code') + projectService.setProject(null) errorHandlingService.block() if lightboxService.getLightboxOpen().length diff --git a/app/coffee/modules/base/navurls.coffee b/app/coffee/modules/base/navurls.coffee index 1552dda1..5cad4a83 100644 --- a/app/coffee/modules/base/navurls.coffee +++ b/app/coffee/modules/base/navurls.coffee @@ -118,7 +118,7 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location, lightboxService, tgSe user = $auth.getUser() options.user = user.username if user - if options['section'] + if name == 'project' path = tgSections.getPath(options['project'], options['section']) name = "#{name}-#{path}" diff --git a/app/coffee/modules/common/sections.coffee b/app/coffee/modules/common/sections.coffee index c04413a8..a7cb9c16 100644 --- a/app/coffee/modules/common/sections.coffee +++ b/app/coffee/modules/common/sections.coffee @@ -44,7 +44,11 @@ class SectionsService extends taiga.Service getPath: (projectSlug, sectionId) -> projects = @currentUserService.projects.get("all") project = projects.find (p) -> return p.get('slug') == projectSlug + + if not sectionId + sectionId = project.get('my_homepage') section = _.find(SECTIONS, {"id": sectionId}) + if !section or project?.get(section.enabled) is not true return "timeline"