summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2018-06-01 16:35:45 -0700
committerFrédéric Guillot <fred@kanboard.net>2018-06-01 16:35:45 -0700
commita0c44d238a6d09a6025fd38b42efff2343e9fc48 (patch)
treeea9d760db3f23fee4b371e98952c9fe12a71644c /app
parent912cf378d730b3df8d285ba765711d9c456bdea0 (diff)
Make sure automatic actions are applied to all tasks when using bulk operations
Diffstat (limited to 'app')
-rw-r--r--app/Action/Base.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/Action/Base.php b/app/Action/Base.php
index 9a502a08..a9939388 100644
--- a/app/Action/Base.php
+++ b/app/Action/Base.php
@@ -21,12 +21,12 @@ abstract class Base extends \Kanboard\Core\Base
private $compatibleEvents = array();
/**
- * Flag for called listener
+ * Keep history of executed events
*
* @access private
- * @var boolean
+ * @var array
*/
- private $called = false;
+ private $callStack = [];
/**
* Project id
@@ -252,17 +252,20 @@ abstract class Base extends \Kanboard\Core\Base
*/
public function execute(GenericEvent $event, $eventName)
{
- // Avoid infinite loop, a listener instance can be called only one time
- if ($this->called) {
+ $data = $event->getAll();
+ $hash = md5(serialize($data).$eventName);
+
+ // Do not call twice the same action with the same arguments.
+ if (isset($this->callStack[$hash])) {
return false;
+ } else {
+ $this->callStack[$hash] = true;
}
- $data = $event->getAll();
$executable = $this->isExecutable($data, $eventName);
$executed = false;
if ($executable) {
- $this->called = true;
$executed = $this->doAction($data);
}