diff --git a/app/assets/javascripts/angular/controllers/dialogs/share.js b/app/assets/javascripts/angular/controllers/dialogs/share.js index d76f337a0d..66a130d220 100644 --- a/app/assets/javascripts/angular/controllers/dialogs/share.js +++ b/app/assets/javascripts/angular/controllers/dialogs/share.js @@ -51,8 +51,6 @@ angular.module('openproject.workPackages.controllers') .then(function(data){ shareModal.deactivate(); $scope.$emit('flashMessage', data.status); - - QueryService.fetchAvailableGroupedQueries($scope.query.project_id); }); }; }]); diff --git a/app/assets/javascripts/angular/services/query-service.js b/app/assets/javascripts/angular/services/query-service.js index 082afdc5c1..3a18d44db5 100644 --- a/app/assets/javascripts/angular/services/query-service.js +++ b/app/assets/javascripts/angular/services/query-service.js @@ -305,6 +305,8 @@ angular.module('openproject.services') saveQuery: function() { var url = PathHelper.apiProjectQueryPath(query.project_id, query.id); return QueryService.doQuery(url, query.toUpdateParams(), 'PUT', function(response){ + QueryService.fetchAvailableGroupedQueries(query.project_id); + return angular.extend(response.data, { status: { text: I18n.t('js.notice_successful_update') }} ); }); }, @@ -314,6 +316,8 @@ angular.module('openproject.services') var url = PathHelper.apiProjectQueriesPath(query.project_id); return QueryService.doQuery(url, query.toParams(), 'POST', function(response){ query.save(response.data.query); + QueryService.fetchAvailableGroupedQueries(query.project_id); + return angular.extend(response.data, { status: { text: I18n.t('js.notice_successful_create') }} ); }); }, @@ -321,7 +325,9 @@ angular.module('openproject.services') deleteQuery: function() { var url = PathHelper.apiProjectQueryPath(query.project_id, query.id); return QueryService.doQuery(url, query.toUpdateParams(), 'DELETE', function(response){ + QueryService.fetchAvailableGroupedQueries(query.project_id); QueryService.resetQuery(); + return angular.extend(response.data, { status: { text: I18n.t('js.notice_successful_delete') }} ); }); },