]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3589. JS "all" hook handlers called only once.
authorBrett Profitt <brett.profitt@gmail.com>
Wed, 24 Aug 2011 22:55:09 +0000 (15:55 -0700)
committerBrett Profitt <brett.profitt@gmail.com>
Wed, 24 Aug 2011 22:55:09 +0000 (15:55 -0700)
js/lib/hooks.js

index eeaffb846da4a3bb8c75a45599010e7525bff602..ab3a8a224036c6bfbcc48b9cd02760d72a878984 100644 (file)
@@ -77,11 +77,23 @@ elgg.trigger_hook = function(name, type, params, value) {
        elgg.provide(name + '.all', hooks);
        elgg.provide('all.all', hooks);
 
-       [       hooks[name][type],
-               hooks['all'][type],
-               hooks[name]['all'],
-               hooks['all']['all']
-       ].every(function(handlers) {
+       var hooksList = [];
+       
+       if (name != 'all' && type != 'all') {
+               hooksList.push(hooks[name][type]);
+       }
+
+       if (type != 'all') {
+               hooksList.push(hooks['all'][type]);
+       }
+
+       if (name != 'all') {
+               hooksList.push(hooks[name]['all']);
+       }
+
+       hooksList.push(hooks['all']['all']);
+
+       hooksList.every(function(handlers) {
                if (handlers instanceof elgg.ElggPriorityList) {
                        handlers.forEach(callHookHandler);
                }