Merge pull request #3803 from ulferts/fix/show_404_on_wp_not_found

prevent ui-routing on wp not found
pull/3806/head
Oliver Günther 9 years ago
commit 0ceefc917e
  1. 7
      frontend/app/openproject-app.js
  2. 4
      frontend/app/routing.js
  3. 10
      spec/features/work_packages/navigation_spec.rb

@ -263,6 +263,13 @@ openprojectApp
CacheService.disableCaching();
}
$rootScope.$on('$stateChangeError',
function(event){
event.preventDefault();
// transitionTo() promise will be rejected with
// a 'transition prevented' error
});
// at the moment of adding this code it was mostly used to
// keep the previous state for the code to know where
// to redirect the user on cancel new work package form

@ -75,10 +75,6 @@ angular.module('openproject')
workPackage: function(WorkPackageService, $stateParams) {
var wsPromise = WorkPackageService.getWorkPackage($stateParams.workPackageId);
wsPromise.catch(function(){
location.href = '/projects';
});
return wsPromise;
},
// TODO hack, get rid of latestTab in ShowController

@ -35,10 +35,11 @@ RSpec.feature 'Work package navigation', selenium: true do
before do
login_as(user)
work_package.save!
end
scenario 'all different angular based work package views', js: true do
work_package.save!
# deep link global work package index
global_work_packages = Pages::WorkPackagesTable.new
global_work_packages.visit!
@ -93,4 +94,11 @@ RSpec.feature 'Work package navigation', selenium: true do
# Safeguard: ensure spec to have finished loading everything before proceeding to the next spec
full_work_package.ensure_page_loaded
end
scenario 'show 404 upon wrong url', js: true do
visit '/work_packages/0'
expect(page).to have_selector('.errorExplanation',
text: I18n.t('notice_file_not_found'))
end
end

Loading…
Cancel
Save