Diff

util/pubsub.lua @ 9218:7e27dc4d100b

util.pubsub: Fire item-published/<node> to allow for easier handling of per-node items
author Matthew Wild <mwild1@gmail.com>
date Sun, 19 Aug 2018 23:37:19 +0100
parent 9207:76d593b35958
child 9220:c4f9469b203f
line wrap: on
line diff
--- a/util/pubsub.lua	Sun Aug 19 21:56:33 2018 +0100
+++ b/util/pubsub.lua	Sun Aug 19 23:37:19 2018 +0100
@@ -517,7 +517,9 @@
 		return nil, "internal-server-error";
 	end
 	if type(ok) == "string" then id = ok; end
-	self.events.fire_event("item-published", { node = node, actor = actor, id = id, item = item });
+	local event_data = { node = node, actor = actor, id = id, item = item };
+	self.events.fire_event("item-published/"..node, event_data);
+	self.events.fire_event("item-published", event_data);
 	self.config.broadcaster("items", node, node_obj.subscribers, item, actor, node_obj, self);
 	return true;
 end