aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-24 15:55:09 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-24 15:55:09 -0700
commitb1cbcfa842abf670c2b5805eb45bc8314836bb2d (patch)
tree9b23a953540968d227aaeaafcb30bfb3c03e5e84 /js/lib
parent9988fa588132704d7b54400e4ef1feeadbe0a390 (diff)
downloadelgg-b1cbcfa842abf670c2b5805eb45bc8314836bb2d.tar.gz
elgg-b1cbcfa842abf670c2b5805eb45bc8314836bb2d.tar.bz2
Fixes #3589. JS "all" hook handlers called only once.
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/hooks.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/js/lib/hooks.js b/js/lib/hooks.js
index eeaffb846..ab3a8a224 100644
--- a/js/lib/hooks.js
+++ b/js/lib/hooks.js
@@ -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);
}