From 79bbcc5d5b070eefb00394211b5cf3bfdbc5416c Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Wed, 6 Aug 2014 09:10:57 +0200 Subject: [PATCH] Remove watcher without receiving the whole WP again --- .../controllers/details-tab-watchers-controller.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/work_packages/controllers/details-tab-watchers-controller.js b/app/assets/javascripts/angular/work_packages/controllers/details-tab-watchers-controller.js index d0b307fb1e..1cda57ddfa 100644 --- a/app/assets/javascripts/angular/work_packages/controllers/details-tab-watchers-controller.js +++ b/app/assets/javascripts/angular/work_packages/controllers/details-tab-watchers-controller.js @@ -103,7 +103,15 @@ angular.module('openproject.workPackages.controllers') function deleteWatcherSuccess(watcher) { $scope.outputMessage(I18n.t("js.label_watcher_deleted_successfully")); - $scope.refreshWorkPackage(); + removeWatcherFromList(watcher); + } + + function removeWatcherFromList(watcher) { + var index = $scope.watchers.indexOf(watcher); + + if (index >= 0) { + $scope.watchers.splice(index, 1); + } } $scope.selectedWatcher = { id: null };