changeset 3526:bcfd6e5bb0f5

mod_pubsub_github: Reorder code to prepare for more code reordering
author Kim Alvefur <zash@zash.se>
date Sun, 31 Mar 2019 19:02:56 +0200 (2019-03-31)
parents 8c1a3b989990
children 0c3043f06ef7
files mod_pubsub_github/mod_pubsub_github.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_github/mod_pubsub_github.lua	Sun Mar 31 18:31:57 2019 +0200
+++ b/mod_pubsub_github/mod_pubsub_github.lua	Sun Mar 31 19:02:56 2019 +0200
@@ -53,6 +53,11 @@
 		return "Invalid JSON. From you of all people...";
 	end
 
+	local node = default_node;
+	if node_mapping then
+		node = node_prefix .. data.repository[node_mapping];
+	end
+
 	local github_event = request.headers.x_github_event
 	if github_event == "push" then
 		module:log("debug", "Handling 'push' event: \n%s\n", tostring(request.body));
@@ -61,11 +66,6 @@
 		return 501;
 	end -- else .. is this even github?
 
-	local node = default_node;
-	if node_mapping then
-		node = node_prefix .. data.repository[node_mapping];
-	end
-
 	for _, commit in ipairs(data.commits) do
 		local ok, err = pubsub_service:publish(node, github_actor, commit.id,
 			st.stanza("item", { id = commit.id, xmlns = "http://jabber.org/protocol/pubsub" })