Avoid using ProjectService when projectIdentifier is null

pull/3802/head
Oliver Günther 9 years ago
parent b6aa77c027
commit 5187fba5d7
  1. 9
      frontend/app/components/work-packages/directives/wp-create-button/wp-create-button.directive.js
  2. 6
      spec/features/work_packages/navigation_spec.rb

@ -54,12 +54,15 @@ function WorkPackageCreateButtonController(AuthorisationService, EditableFieldsS
vm.text = I18n.t('js.toolbar.unselected_title');
vm.isDisabled = function () {
return EditableFieldsState.editAll.state
|| AuthorisationService.cannot('work_package', 'create')
&& AuthorisationService.cannot('work_package', 'duplicate');
return vm.projectIdentifier
|| EditableFieldsState.editAll.state
|| (AuthorisationService.cannot('work_package', 'create')
&& AuthorisationService.cannot('work_package', 'duplicate'));
};
if (vm.projectIdentifier) {
ProjectService.getProject(vm.projectIdentifier).then(function(project) {
vm.types = project.embedded.types;
});
}
}

@ -28,7 +28,7 @@
require 'spec_helper'
RSpec.feature 'Work package navigation', selenium: true do
RSpec.feature 'Work package navigation', js: true, selenium: true do
let(:user) { FactoryGirl.create(:admin) }
let(:project) { FactoryGirl.create(:project) }
let(:work_package) { FactoryGirl.build(:work_package, project: project) }
@ -37,7 +37,7 @@ RSpec.feature 'Work package navigation', selenium: true do
login_as(user)
end
scenario 'all different angular based work package views', js: true do
scenario 'all different angular based work package views' do
work_package.save!
# deep link global work package index
@ -95,7 +95,7 @@ RSpec.feature 'Work package navigation', selenium: true do
full_work_package.ensure_page_loaded
end
scenario 'show 404 upon wrong url', js: true do
scenario 'show 404 upon wrong url' do
visit '/work_packages/0'
expect(page).to have_selector('.errorExplanation',

Loading…
Cancel
Save