parent
5f435ff882
commit
b69622cd5b
|
@ -6,6 +6,7 @@
|
||||||
### Features
|
### Features
|
||||||
- Show a confirmation notice when you exit edit mode by pressing ESC in the markdown inputs.
|
- Show a confirmation notice when you exit edit mode by pressing ESC in the markdown inputs.
|
||||||
- Add the tribe button to link stories from tree.taiga.io with gigs in tribe.taiga.io.
|
- Add the tribe button to link stories from tree.taiga.io with gigs in tribe.taiga.io.
|
||||||
|
- Errors (not found, server error, permissions and blocked project) don't change the current url.
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
- Lots of small and not so small bugfixes.
|
- Lots of small and not so small bugfixes.
|
||||||
|
|
|
@ -443,7 +443,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
$routeProvider.when("/permission-denied",
|
$routeProvider.when("/permission-denied",
|
||||||
{templateUrl: "error/permission-denied.html"})
|
{templateUrl: "error/permission-denied.html"})
|
||||||
|
|
||||||
$routeProvider.otherwise({redirectTo: "/not-found"})
|
$routeProvider.otherwise({templateUrl: "error/not-found.html"})
|
||||||
$locationProvider.html5Mode({enabled: true, requireBase: false})
|
$locationProvider.html5Mode({enabled: true, requireBase: false})
|
||||||
|
|
||||||
defaultHeaders = {
|
defaultHeaders = {
|
||||||
|
@ -465,12 +465,12 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
$tgEventsProvider.setSessionId(taiga.sessionId)
|
$tgEventsProvider.setSessionId(taiga.sessionId)
|
||||||
|
|
||||||
# Add next param when user try to access to a secction need auth permissions.
|
# Add next param when user try to access to a secction need auth permissions.
|
||||||
authHttpIntercept = ($q, $location, $navUrls, $lightboxService) ->
|
authHttpIntercept = ($q, $location, $navUrls, $lightboxService, errorHandlingService) ->
|
||||||
httpResponseError = (response) ->
|
httpResponseError = (response) ->
|
||||||
if response.status == 0 || (response.status == -1 && !response.config.cancelable)
|
if response.status == 0 || (response.status == -1 && !response.config.cancelable)
|
||||||
$lightboxService.closeAll()
|
$lightboxService.closeAll()
|
||||||
$location.path($navUrls.resolve("error"))
|
|
||||||
$location.replace()
|
errorHandlingService.error()
|
||||||
else if response.status == 401 and $location.url().indexOf('/login') == -1
|
else if response.status == 401 and $location.url().indexOf('/login') == -1
|
||||||
nextUrl = encodeURIComponent($location.url())
|
nextUrl = encodeURIComponent($location.url())
|
||||||
$location.url($navUrls.resolve("login")).search("next=#{nextUrl}")
|
$location.url($navUrls.resolve("login")).search("next=#{nextUrl}")
|
||||||
|
@ -481,7 +481,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
responseError: httpResponseError
|
responseError: httpResponseError
|
||||||
}
|
}
|
||||||
|
|
||||||
$provide.factory("authHttpIntercept", ["$q", "$location", "$tgNavUrls", "lightboxService",
|
$provide.factory("authHttpIntercept", ["$q", "$location", "$tgNavUrls", "lightboxService", "tgErrorHandlingService",
|
||||||
authHttpIntercept])
|
authHttpIntercept])
|
||||||
|
|
||||||
$httpProvider.interceptors.push("authHttpIntercept")
|
$httpProvider.interceptors.push("authHttpIntercept")
|
||||||
|
@ -536,7 +536,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
$httpProvider.interceptors.push("versionCheckHttpIntercept")
|
$httpProvider.interceptors.push("versionCheckHttpIntercept")
|
||||||
|
|
||||||
|
|
||||||
blockingIntercept = ($q, $routeParams, $location, $navUrls) ->
|
blockingIntercept = ($q, $routeParams, $location, $navUrls, errorHandlingService) ->
|
||||||
# API calls can return blocked elements and in that situation the user will be redirected
|
# API calls can return blocked elements and in that situation the user will be redirected
|
||||||
# to the blocked project page
|
# to the blocked project page
|
||||||
# This can happens in two scenarios
|
# This can happens in two scenarios
|
||||||
|
@ -544,10 +544,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
# - An error reponse when updating/creating/deleting including a 451 error code
|
# - An error reponse when updating/creating/deleting including a 451 error code
|
||||||
redirectToBlockedPage = ->
|
redirectToBlockedPage = ->
|
||||||
pslug = $routeParams.pslug
|
pslug = $routeParams.pslug
|
||||||
blockedUrl = $navUrls.resolve("blocked-project", {project: pslug})
|
errorHandlingService.block()
|
||||||
currentUrl = $location.url()
|
|
||||||
if currentUrl.indexOf(blockedUrl) == -1
|
|
||||||
$location.replace().path(blockedUrl)
|
|
||||||
|
|
||||||
responseOk = (response) ->
|
responseOk = (response) ->
|
||||||
if response.data.blocked_code
|
if response.data.blocked_code
|
||||||
|
@ -566,7 +563,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
responseError: responseError
|
responseError: responseError
|
||||||
}
|
}
|
||||||
|
|
||||||
$provide.factory("blockingIntercept", ["$q", "$routeParams", "$location", "$tgNavUrls", blockingIntercept])
|
$provide.factory("blockingIntercept", ["$q", "$routeParams", "$location", "$tgNavUrls", "tgErrorHandlingService", blockingIntercept])
|
||||||
|
|
||||||
$httpProvider.interceptors.push("blockingIntercept")
|
$httpProvider.interceptors.push("blockingIntercept")
|
||||||
|
|
||||||
|
@ -637,7 +634,7 @@ i18nInit = (lang, $translate) ->
|
||||||
checksley.updateMessages('default', messages)
|
checksley.updateMessages('default', messages)
|
||||||
|
|
||||||
|
|
||||||
init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $navUrls, appMetaService, projectService, loaderService, navigationBarService) ->
|
init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $navUrls, appMetaService, projectService, loaderService, navigationBarService, errorHandlingService) ->
|
||||||
$log.debug("Initialize application")
|
$log.debug("Initialize application")
|
||||||
|
|
||||||
$rootscope.$on '$translatePartialLoaderStructureChanged', () ->
|
$rootscope.$on '$translatePartialLoaderStructureChanged', () ->
|
||||||
|
@ -691,6 +688,8 @@ init = ($log, $rootscope, $auth, $events, $analytics, $translate, $location, $na
|
||||||
un()
|
un()
|
||||||
|
|
||||||
$rootscope.$on '$routeChangeSuccess', (event, next) ->
|
$rootscope.$on '$routeChangeSuccess', (event, next) ->
|
||||||
|
errorHandlingService.init()
|
||||||
|
|
||||||
if next.loader
|
if next.loader
|
||||||
loaderService.start(true)
|
loaderService.start(true)
|
||||||
|
|
||||||
|
@ -803,6 +802,6 @@ module.run([
|
||||||
"tgProjectService",
|
"tgProjectService",
|
||||||
"tgLoader",
|
"tgLoader",
|
||||||
"tgNavigationBarService",
|
"tgNavigationBarService",
|
||||||
"$route",
|
"tgErrorHandlingService",
|
||||||
init
|
init
|
||||||
])
|
])
|
||||||
|
|
|
@ -28,11 +28,9 @@ class TaigaController extends TaigaBase
|
||||||
onInitialDataError: (xhr) =>
|
onInitialDataError: (xhr) =>
|
||||||
if xhr
|
if xhr
|
||||||
if xhr.status == 404
|
if xhr.status == 404
|
||||||
@location.path(@navUrls.resolve("not-found"))
|
@errorHandlingService.notfound()
|
||||||
@location.replace()
|
|
||||||
else if xhr.status == 403
|
else if xhr.status == 403
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
@location.replace()
|
|
||||||
|
|
||||||
return @q.reject(xhr)
|
return @q.reject(xhr)
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,13 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgAuth"
|
"$tgAuth",
|
||||||
"tgLightboxFactory"
|
"tgLightboxFactory",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @analytics,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @analytics,
|
||||||
@appMetaService, @translate, @auth, @lightboxFactory) ->
|
@appMetaService, @translate, @auth, @lightboxFactory, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.project = {}
|
@scope.project = {}
|
||||||
|
@ -75,7 +76,7 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.i_am_admin
|
if not project.i_am_admin
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -53,11 +53,12 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgAuth",
|
"$tgAuth",
|
||||||
"tgCurrentUserService"
|
"tgCurrentUserService",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
||||||
@appMetaService, @translate, @tgAuth, @currentUserService) ->
|
@appMetaService, @translate, @tgAuth, @currentUserService, @errorHandlingService) ->
|
||||||
@scope.project = {}
|
@scope.project = {}
|
||||||
|
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
|
@ -83,7 +84,7 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.i_am_admin
|
if not project.i_am_admin
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -50,11 +50,12 @@ class ProjectValuesSectionController extends mixOf(taiga.Controller, taiga.PageM
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
||||||
@appMetaService, @translate) ->
|
@appMetaService, @translate, @errorHandlingService) ->
|
||||||
@scope.project = {}
|
@scope.project = {}
|
||||||
|
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
|
@ -74,7 +75,7 @@ class ProjectValuesSectionController extends mixOf(taiga.Controller, taiga.PageM
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.i_am_admin
|
if not project.i_am_admin
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -48,11 +48,12 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
||||||
@appMetaService, @translate) ->
|
@appMetaService, @translate, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.sectionName = "ADMIN.MENU.PERMISSIONS"
|
@scope.sectionName = "ADMIN.MENU.PERMISSIONS"
|
||||||
|
@ -71,7 +72,7 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.i_am_admin
|
if not project.i_am_admin
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -45,10 +45,11 @@ class WebhooksController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @repo, @rs, @params, @location, @navUrls, @appMetaService, @translate) ->
|
constructor: (@scope, @repo, @rs, @params, @location, @navUrls, @appMetaService, @translate, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.sectionName = "ADMIN.WEBHOOKS.SECTION_NAME"
|
@scope.sectionName = "ADMIN.WEBHOOKS.SECTION_NAME"
|
||||||
|
@ -72,7 +73,7 @@ class WebhooksController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.i_am_admin
|
if not project.i_am_admin
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -56,11 +56,12 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgLoading",
|
"$tgLoading",
|
||||||
"tgResources",
|
"tgResources",
|
||||||
"$tgQueueModelTransformation"
|
"$tgQueueModelTransformation",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appMetaService, @navUrls,
|
||||||
@location, @appMetaService, @navUrls, @events, @analytics, @translate, @loading, @rs2, @modelTransform) ->
|
@events, @analytics, @translate, @loading, @rs2, @modelTransform, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@.page = 1
|
@.page = 1
|
||||||
|
@ -317,7 +318,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.is_backlog_activated
|
if not project.is_backlog_activated
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -52,11 +52,12 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgQueueModelTransformation"
|
"$tgQueueModelTransformation",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
||||||
@log, @appMetaService, @analytics, @navUrls, @translate, @modelTransform) ->
|
@log, @appMetaService, @analytics, @navUrls, @translate, @modelTransform, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.issueRef = @params.issueref
|
@scope.issueRef = @params.issueref
|
||||||
|
|
|
@ -54,11 +54,12 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgEvents",
|
"$tgEvents",
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @urls, @params, @q, @location, @appMetaService,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @urls, @params, @q, @location, @appMetaService,
|
||||||
@navUrls, @events, @analytics, @translate) ->
|
@navUrls, @events, @analytics, @translate, @errorHandlingService) ->
|
||||||
@scope.sectionName = "Issues"
|
@scope.sectionName = "Issues"
|
||||||
@scope.filters = {}
|
@scope.filters = {}
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.is_issues_activated
|
if not project.is_issues_activated
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -61,11 +61,12 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgEvents",
|
"$tgEvents",
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
||||||
@appMetaService, @navUrls, @events, @analytics, @translate) ->
|
@appMetaService, @navUrls, @events, @analytics, @translate, @errorHandlingService) ->
|
||||||
|
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
|
@ -193,7 +194,7 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.is_kanban_activated
|
if not project.is_kanban_activated
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -48,10 +48,11 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @repo, @rs, @params, @q, @location, @appMetaService, @navUrls, @translate) ->
|
constructor: (@scope, @repo, @rs, @params, @q, @location, @appMetaService, @navUrls, @translate, @errorHandlingService) ->
|
||||||
@scope.sectionName = "Search"
|
@scope.sectionName = "Search"
|
||||||
|
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
|
|
|
@ -52,11 +52,12 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgNavUrls"
|
"$tgNavUrls"
|
||||||
"$tgEvents"
|
"$tgEvents"
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @appMetaService, @location, @navUrls,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @appMetaService, @location, @navUrls,
|
||||||
@events, @analytics, @translate) ->
|
@events, @analytics, @translate, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.sectionName = @translate.instant("TASKBOARD.SECTION_NAME")
|
@scope.sectionName = @translate.instant("TASKBOARD.SECTION_NAME")
|
||||||
|
@ -124,7 +125,7 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||||
if not project.is_backlog_activated
|
if not project.is_backlog_activated
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
# Not used at this momment
|
# Not used at this momment
|
||||||
|
|
|
@ -50,11 +50,12 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgQueueModelTransformation"
|
"$tgQueueModelTransformation",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
||||||
@log, @appMetaService, @navUrls, @analytics, @translate, @modelTransform) ->
|
@log, @appMetaService, @navUrls, @analytics, @translate, @modelTransform, @errorHandlingService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.taskRef = @params.taskref
|
@scope.taskRef = @params.taskref
|
||||||
|
|
|
@ -45,11 +45,12 @@ class TeamController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$tgAuth",
|
"$tgAuth",
|
||||||
"$translate",
|
"$translate",
|
||||||
"tgProjectService"
|
"tgProjectService",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @rs, @params, @q, @location, @navUrls, @appMetaService, @auth,
|
constructor: (@scope, @rootscope, @repo, @rs, @params, @q, @location, @navUrls, @appMetaService, @auth,
|
||||||
@translate, @projectService) ->
|
@translate, @projectService, @errorHandlingService) ->
|
||||||
@scope.sectionName = "TEAM.SECTION_NAME"
|
@scope.sectionName = "TEAM.SECTION_NAME"
|
||||||
|
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
|
|
|
@ -45,19 +45,19 @@ class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgAuth",
|
"$tgAuth",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @config, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
constructor: (@scope, @rootscope, @config, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
||||||
@auth, @translate) ->
|
@auth, @translate, @errorHandlingService) ->
|
||||||
@scope.sectionName = "USER_SETTINGS.MENU.SECTION_TITLE"
|
@scope.sectionName = "USER_SETTINGS.MENU.SECTION_TITLE"
|
||||||
|
|
||||||
@scope.project = {}
|
@scope.project = {}
|
||||||
@scope.user = @auth.getUser()
|
@scope.user = @auth.getUser()
|
||||||
|
|
||||||
if !@scope.user
|
if !@scope.user
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
@location.replace()
|
|
||||||
|
|
||||||
@scope.lang = @getLan()
|
@scope.lang = @getLan()
|
||||||
@scope.theme = @getTheme()
|
@scope.theme = @getTheme()
|
||||||
|
|
|
@ -44,10 +44,11 @@ class UserNotificationsController extends mixOf(taiga.Controller, taiga.PageMixi
|
||||||
"$q",
|
"$q",
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgAuth"
|
"$tgAuth",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth) ->
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth, @errorHandlingService) ->
|
||||||
@scope.sectionName = "USER_SETTINGS.NOTIFICATIONS.SECTION_NAME"
|
@scope.sectionName = "USER_SETTINGS.NOTIFICATIONS.SECTION_NAME"
|
||||||
@scope.user = @auth.getUser()
|
@scope.user = @auth.getUser()
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
|
|
|
@ -50,12 +50,13 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgConfig",
|
"$tgQueueModelTransformation",
|
||||||
"$tgQueueModelTransformation"
|
"tgErrorHandlingService",
|
||||||
|
"$tgConfig"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @log, @appMetaService,
|
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location,
|
||||||
@navUrls, @analytics, @translate, @configService, @modelTransform) ->
|
@log, @appMetaService, @navUrls, @analytics, @translate, @modelTransform, @errorHandlingService, @configService) ->
|
||||||
bindMethods(@)
|
bindMethods(@)
|
||||||
|
|
||||||
@scope.usRef = @params.usref
|
@scope.usRef = @params.usref
|
||||||
|
|
|
@ -51,11 +51,12 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"tgAppMetaService",
|
"tgAppMetaService",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgAnalytics",
|
"$tgAnalytics",
|
||||||
"$translate"
|
"$translate",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @repo, @model, @confirm, @rs, @params, @q, @location,
|
constructor: (@scope, @rootscope, @repo, @model, @confirm, @rs, @params, @q, @location,
|
||||||
@filter, @log, @appMetaService, @navUrls, @analytics, @translate) ->
|
@filter, @log, @appMetaService, @navUrls, @analytics, @translate, @errorHandlingService) ->
|
||||||
@scope.projectSlug = @params.pslug
|
@scope.projectSlug = @params.pslug
|
||||||
@scope.wikiSlug = @params.slug
|
@scope.wikiSlug = @params.slug
|
||||||
@scope.wikiTitle = @scope.wikiSlug
|
@scope.wikiTitle = @scope.wikiSlug
|
||||||
|
@ -86,7 +87,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
return @rs.projects.getBySlug(@params.pslug).then (project) =>
|
||||||
if not project.is_wiki_activated
|
if not project.is_wiki_activated
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
|
|
||||||
@scope.projectId = project.id
|
@scope.projectId = project.id
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
|
|
@ -20,9 +20,13 @@ html(lang="en")
|
||||||
window.prerenderReady = false;
|
window.prerenderReady = false;
|
||||||
|
|
||||||
body(tg-main)
|
body(tg-main)
|
||||||
div(tg-navigation-bar)
|
div(tg-navigation-bar, ng-if="!errorHandling.showingError")
|
||||||
|
div.master(ng-view, ng-if="!errorHandling.showingError")
|
||||||
|
|
||||||
div.master(ng-view)
|
div(ng-if="errorHandling.notfound", ng-include="'error/not-found.html'")
|
||||||
|
div(ng-if="errorHandling.error", ng-include="'error/error.html'")
|
||||||
|
div(ng-if="errorHandling.permissionDenied", ng-include="'error/permission-denied.html'")
|
||||||
|
div(ng-if="errorHandling.blocked", ng-include="'projects/project/blocked-project.html'")
|
||||||
|
|
||||||
div.lightbox.lightbox-generic-ask
|
div.lightbox.lightbox-generic-ask
|
||||||
include partials/includes/modules/lightbox-generic-ask
|
include partials/includes/modules/lightbox-generic-ask
|
||||||
|
|
|
@ -28,10 +28,11 @@ class TransferProject
|
||||||
"tgCurrentUserService",
|
"tgCurrentUserService",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$translate",
|
"$translate",
|
||||||
"$tgConfirm"
|
"$tgConfirm",
|
||||||
|
"tgErrorHandlingService"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@routeParams, @projectService, @location, @authService, @currentUserService, @navUrls, @translate, @confirmService) ->
|
constructor: (@routeParams, @projectService, @location, @authService, @currentUserService, @navUrls, @translate, @confirmService, @errorHandlingService) ->
|
||||||
|
|
||||||
initialize: () ->
|
initialize: () ->
|
||||||
@.projectId = @.project.get("id")
|
@.projectId = @.project.get("id")
|
||||||
|
@ -41,7 +42,7 @@ class TransferProject
|
||||||
|
|
||||||
_validateToken: () ->
|
_validateToken: () ->
|
||||||
return @projectService.transferValidateToken(@.projectId, @.token).then null, (data, status) =>
|
return @projectService.transferValidateToken(@.projectId, @.token).then null, (data, status) =>
|
||||||
@location.path(@navUrls.resolve("not-found"))
|
@errorHandlingService.notfound()
|
||||||
|
|
||||||
_refreshUserData: () ->
|
_refreshUserData: () ->
|
||||||
return @authService.refresh().then () =>
|
return @authService.refresh().then () =>
|
||||||
|
|
|
@ -28,6 +28,13 @@ describe "TransferProject", ->
|
||||||
mocks.routeParams = {}
|
mocks.routeParams = {}
|
||||||
provide.value "$routeParams", mocks.routeParams
|
provide.value "$routeParams", mocks.routeParams
|
||||||
|
|
||||||
|
_mockErrorHandlingService = () ->
|
||||||
|
mocks.errorHandlingService = {
|
||||||
|
notfound: sinon.stub()
|
||||||
|
}
|
||||||
|
|
||||||
|
provide.value "tgErrorHandlingService", mocks.errorHandlingService
|
||||||
|
|
||||||
_mockProjectsService = () ->
|
_mockProjectsService = () ->
|
||||||
mocks.projectsService = {
|
mocks.projectsService = {
|
||||||
transferValidateToken: sinon.stub()
|
transferValidateToken: sinon.stub()
|
||||||
|
@ -90,6 +97,7 @@ describe "TransferProject", ->
|
||||||
_mockTgNavUrls()
|
_mockTgNavUrls()
|
||||||
_mockTranslate()
|
_mockTranslate()
|
||||||
_mockTgConfirm()
|
_mockTgConfirm()
|
||||||
|
_mockErrorHandlingService()
|
||||||
return null
|
return null
|
||||||
|
|
||||||
_inject = (callback) ->
|
_inject = (callback) ->
|
||||||
|
@ -119,7 +127,7 @@ describe "TransferProject", ->
|
||||||
ctrl = $controller("TransferProjectController")
|
ctrl = $controller("TransferProjectController")
|
||||||
ctrl.project = project
|
ctrl.project = project
|
||||||
ctrl.initialize().then () ->
|
ctrl.initialize().then () ->
|
||||||
expect(mocks.location.path).to.be.calledWith("/not-found")
|
expect(mocks.errorHandlingService.notfound).have.been.called;
|
||||||
done()
|
done()
|
||||||
|
|
||||||
it "valid token private project with max projects for user", (done) ->
|
it "valid token private project with max projects for user", (done) ->
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
###
|
||||||
|
# Copyright (C) 2014-2016 Taiga Agile LLC <taiga@taiga.io>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# File: error-handling.service.coffee
|
||||||
|
###
|
||||||
|
|
||||||
|
taiga = @.taiga
|
||||||
|
|
||||||
|
class ErrorHandlingService
|
||||||
|
@.$inject = [
|
||||||
|
"$rootScope"
|
||||||
|
]
|
||||||
|
|
||||||
|
constructor: (@rootScope) ->
|
||||||
|
|
||||||
|
init: () ->
|
||||||
|
@rootScope.errorHandling = {};
|
||||||
|
|
||||||
|
notfound: ->
|
||||||
|
@rootScope.errorHandling.showingError = true
|
||||||
|
@rootScope.errorHandling.notfound = true
|
||||||
|
|
||||||
|
error: ->
|
||||||
|
@rootScope.errorHandling.showingError = true
|
||||||
|
@rootScope.errorHandling.error = true
|
||||||
|
|
||||||
|
permissionDenied: ->
|
||||||
|
@rootScope.errorHandling.showingError = true
|
||||||
|
@rootScope.errorHandling.permissionDenied = true
|
||||||
|
|
||||||
|
block: ->
|
||||||
|
@rootScope.errorHandling.showingError = true
|
||||||
|
@rootScope.errorHandling.blocked = true
|
||||||
|
|
||||||
|
angular.module("taigaCommon").service("tgErrorHandlingService", ErrorHandlingService)
|
|
@ -20,19 +20,16 @@
|
||||||
class xhrError extends taiga.Service
|
class xhrError extends taiga.Service
|
||||||
@.$inject = [
|
@.$inject = [
|
||||||
"$q",
|
"$q",
|
||||||
"$location",
|
"tgErrorHandlingService"
|
||||||
"$tgNavUrls"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@q, @location, @navUrls) ->
|
constructor: (@q, @errorHandlingService) ->
|
||||||
|
|
||||||
notFound: () ->
|
notFound: () ->
|
||||||
@location.path(@navUrls.resolve("not-found"))
|
@errorHandlingService.notfound()
|
||||||
@location.replace()
|
|
||||||
|
|
||||||
permissionDenied: () ->
|
permissionDenied: () ->
|
||||||
@location.path(@navUrls.resolve("permission-denied"))
|
@errorHandlingService.permissionDenied()
|
||||||
@location.replace()
|
|
||||||
|
|
||||||
response: (xhr) ->
|
response: (xhr) ->
|
||||||
if xhr
|
if xhr
|
||||||
|
|
|
@ -28,20 +28,14 @@ describe "tgXhrErrorService", ->
|
||||||
|
|
||||||
provide.value "$q", mocks.q
|
provide.value "$q", mocks.q
|
||||||
|
|
||||||
_mockLocation = () ->
|
|
||||||
mocks.location = {
|
_mockErrorHandling = () ->
|
||||||
path: sinon.spy(),
|
mocks.errorHandling = {
|
||||||
replace: sinon.spy()
|
notfound: sinon.stub(),
|
||||||
|
permissionDenied: sinon.stub()
|
||||||
}
|
}
|
||||||
|
|
||||||
provide.value "$location", mocks.location
|
provide.value "tgErrorHandlingService", mocks.errorHandling
|
||||||
|
|
||||||
_mockNavUrls = () ->
|
|
||||||
mocks.navUrls = {
|
|
||||||
resolve: sinon.stub()
|
|
||||||
}
|
|
||||||
|
|
||||||
provide.value "$tgNavUrls", mocks.navUrls
|
|
||||||
|
|
||||||
_inject = (callback) ->
|
_inject = (callback) ->
|
||||||
inject (_tgXhrErrorService_) ->
|
inject (_tgXhrErrorService_) ->
|
||||||
|
@ -52,8 +46,7 @@ describe "tgXhrErrorService", ->
|
||||||
module ($provide) ->
|
module ($provide) ->
|
||||||
provide = $provide
|
provide = $provide
|
||||||
_mockQ()
|
_mockQ()
|
||||||
_mockLocation()
|
_mockErrorHandling()
|
||||||
_mockNavUrls()
|
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
@ -70,23 +63,17 @@ describe "tgXhrErrorService", ->
|
||||||
status: 404
|
status: 404
|
||||||
}
|
}
|
||||||
|
|
||||||
mocks.navUrls.resolve.withArgs("not-found").returns("not-found")
|
|
||||||
|
|
||||||
xhrErrorService.response(xhr)
|
xhrErrorService.response(xhr)
|
||||||
|
|
||||||
expect(mocks.q.reject.withArgs(xhr)).to.be.calledOnce
|
expect(mocks.q.reject.withArgs(xhr)).to.be.calledOnce
|
||||||
expect(mocks.location.path.withArgs("not-found")).to.be.calledOnce
|
expect(mocks.errorHandling.notfound).to.be.calledOnce
|
||||||
expect(mocks.location.replace).to.be.calledOnce
|
|
||||||
|
|
||||||
it "403 status redirect to permission-denied page", () ->
|
it "403 status redirect to permission-denied page", () ->
|
||||||
xhr = {
|
xhr = {
|
||||||
status: 403
|
status: 403
|
||||||
}
|
}
|
||||||
|
|
||||||
mocks.navUrls.resolve.withArgs("permission-denied").returns("permission-denied")
|
|
||||||
|
|
||||||
xhrErrorService.response(xhr)
|
xhrErrorService.response(xhr)
|
||||||
|
|
||||||
expect(mocks.q.reject.withArgs(xhr)).to.be.calledOnce
|
expect(mocks.q.reject.withArgs(xhr)).to.be.calledOnce
|
||||||
expect(mocks.location.path.withArgs("permission-denied")).to.be.calledOnce
|
expect(mocks.errorHandling.permissionDenied).to.be.calledOnce
|
||||||
expect(mocks.location.replace).to.be.calledOnce
|
|
||||||
|
|
Loading…
Reference in New Issue