Changeset

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
parents 9217:7df29c5fbb9b
children 9219:3ce18a4018f4
files util/pubsub.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
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