Comparison

util/pubsub.lua @ 10537:c5558138ce33

util.pubsub: Silence luacheck warnings, leaving notes on future proper fix
author Kim Alvefur <zash@zash.se>
date Mon, 23 Dec 2019 21:16:10 +0100
parent 10521:cbb2c3f8bb1d
child 11567:c471e19a238e
comparison
equal deleted inserted replaced
10536:a469d2bcea96 10537:c5558138ce33
279 jid = self.config.normalize_jid(jid); 279 jid = self.config.normalize_jid(jid);
280 local old_affiliation = node_obj.affiliations[jid]; 280 local old_affiliation = node_obj.affiliations[jid];
281 node_obj.affiliations[jid] = affiliation; 281 node_obj.affiliations[jid] = affiliation;
282 282
283 if self.config.nodestore then 283 if self.config.nodestore then
284 local ok, err = save_node_to_store(self, node_obj); 284 -- TODO pass the error from storage to caller eg wrapped in an util.error
285 local ok, err = save_node_to_store(self, node_obj); -- luacheck: ignore 211/err
285 if not ok then 286 if not ok then
286 node_obj.affiliations[jid] = old_affiliation; 287 node_obj.affiliations[jid] = old_affiliation;
287 return ok, "internal-server-error"; 288 return ok, "internal-server-error";
288 end 289 end
289 end 290 end
343 else 344 else
344 self.subscriptions[normal_jid] = { [jid] = { [node] = true } }; 345 self.subscriptions[normal_jid] = { [jid] = { [node] = true } };
345 end 346 end
346 347
347 if self.config.nodestore then 348 if self.config.nodestore then
348 local ok, err = save_node_to_store(self, node_obj); 349 -- TODO pass the error from storage to caller eg wrapped in an util.error
350 local ok, err = save_node_to_store(self, node_obj); -- luacheck: ignore 211/err
349 if not ok then 351 if not ok then
350 node_obj.subscribers[jid] = old_subscription; 352 node_obj.subscribers[jid] = old_subscription;
351 self.subscriptions[normal_jid][jid][node] = old_subscription and true or nil; 353 self.subscriptions[normal_jid][jid][node] = old_subscription and true or nil;
352 return ok, "internal-server-error"; 354 return ok, "internal-server-error";
353 end 355 end
395 self.subscriptions[normal_jid] = nil; 397 self.subscriptions[normal_jid] = nil;
396 end 398 end
397 end 399 end
398 400
399 if self.config.nodestore then 401 if self.config.nodestore then
400 local ok, err = save_node_to_store(self, node_obj); 402 -- TODO pass the error from storage to caller eg wrapped in an util.error
403 local ok, err = save_node_to_store(self, node_obj); -- luacheck: ignore 211/err
401 if not ok then 404 if not ok then
402 node_obj.subscribers[jid] = old_subscription; 405 node_obj.subscribers[jid] = old_subscription;
403 self.subscriptions[normal_jid][jid][node] = old_subscription and true or nil; 406 self.subscriptions[normal_jid][jid][node] = old_subscription and true or nil;
404 return ok, "internal-server-error"; 407 return ok, "internal-server-error";
405 end 408 end
453 config = config; 456 config = config;
454 affiliations = {}; 457 affiliations = {};
455 }; 458 };
456 459
457 if self.config.nodestore then 460 if self.config.nodestore then
458 local ok, err = save_node_to_store(self, self.nodes[node]); 461 -- TODO pass the error from storage to caller eg wrapped in an util.error
462 local ok, err = save_node_to_store(self, self.nodes[node]); -- luacheck: ignore 211/err
459 if not ok then 463 if not ok then
460 self.nodes[node] = nil; 464 self.nodes[node] = nil;
461 return ok, "internal-server-error"; 465 return ok, "internal-server-error";
462 end 466 end
463 end 467 end
772 776
773 local old_config = node_obj.config; 777 local old_config = node_obj.config;
774 node_obj.config = new_config; 778 node_obj.config = new_config;
775 779
776 if self.config.nodestore then 780 if self.config.nodestore then
777 local ok, err = save_node_to_store(self, node_obj); 781 -- TODO pass the error from storage to caller eg wrapped in an util.error
782 local ok, err = save_node_to_store(self, node_obj); -- luacheck: ignore 211/err
778 if not ok then 783 if not ok then
779 node_obj.config = old_config; 784 node_obj.config = old_config;
780 return ok, "internal-server-error"; 785 return ok, "internal-server-error";
781 end 786 end
782 end 787 end