diff --git a/frontend/app/components/wp-buttons/wp-inline-create-button/wp-inline-create-button.controller.ts b/frontend/app/components/wp-buttons/wp-inline-create-button/wp-inline-create-button.controller.ts index 881a3b43d2..f918d31793 100644 --- a/frontend/app/components/wp-buttons/wp-inline-create-button/wp-inline-create-button.controller.ts +++ b/frontend/app/components/wp-buttons/wp-inline-create-button/wp-inline-create-button.controller.ts @@ -30,6 +30,7 @@ import {wpButtonsModule} from '../../../angular-modules'; import WorkPackageCreateButtonController from '../wp-create-button/wp-create-button.controller'; import {WorkPackageCreateService} from "../../wp-create/wp-create.service"; import {scopedObservable} from "../../../helpers/angular-rx-utils"; +import {WorkPackageCacheService} from "../../work-packages/work-package-cache.service"; class WorkPackageInlineCreateButtonController extends WorkPackageCreateButtonController { public query:op.Query; @@ -44,6 +45,7 @@ class WorkPackageInlineCreateButtonController extends WorkPackageCreateButtonCon protected $element, protected FocusHelper, protected I18n, + protected wpCacheService:WorkPackageCacheService, protected wpCreate:WorkPackageCreateService) { super($state, I18n); @@ -68,7 +70,8 @@ class WorkPackageInlineCreateButtonController extends WorkPackageCreateButtonCon } public addWorkPackageRow() { - scopedObservable(this.$scope, this.wpCreate.createNewWorkPackage(this.projectIdentifier)).subscribe(wp => { + this.wpCreate.createNewWorkPackage(this.projectIdentifier).then(wp => { + this.wpCacheService.updateWorkPackage(wp); this._wp = wp; this._wp.inlineCreated = true; diff --git a/frontend/app/components/wp-table/wp-table.directive.ts b/frontend/app/components/wp-table/wp-table.directive.ts index 2e82f7941b..33458c118d 100644 --- a/frontend/app/components/wp-table/wp-table.directive.ts +++ b/frontend/app/components/wp-table/wp-table.directive.ts @@ -243,7 +243,7 @@ function wpTable( /** Save callbacks for work package */ scope.onWorkPackageSave = function(workPackage, fields) { - $rootScope.$emit('workPackageSaved', this.workPackage); + $rootScope.$emit('workPackageSaved', workPackage); $rootScope.$emit('workPackagesRefreshInBackground'); } ; } diff --git a/spec/features/work_packages/table/create_work_packages_spec.rb b/spec/features/work_packages/table/create_work_packages_spec.rb index ccd578d64e..7aa092a5dc 100644 --- a/spec/features/work_packages/table/create_work_packages_spec.rb +++ b/spec/features/work_packages/table/create_work_packages_spec.rb @@ -69,6 +69,12 @@ describe 'inline create work package', js: true do expect(page).to have_selector('.wp--row .subject', text: 'Some subject') expect(page).to have_selector('.wp--row .subject', text: 'Another subject') + # safegurards + wp_table.dismiss_notification! + wp_table.expect_no_notification( + message: 'Successful update. Click here to open this work package in fullscreen view.' + ) + # Cancel creation expect(page).to have_selector('.wp--row.-new') page.find('.wp-table--cancel-create-link').click