Software /
code /
prosody
Changeset
8954:3b6095686498
util.pubsub: Persistence on affiliation change
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 01 Jul 2018 04:33:15 +0200 |
parents | 8953:19cbe80df9c8 |
children | 8955:ca6a09cf2829 |
files | util/pubsub.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/pubsub.lua Sun Jul 01 04:32:26 2018 +0200 +++ b/util/pubsub.lua Sun Jul 01 04:33:15 2018 +0200 @@ -121,7 +121,17 @@ return false, "item-not-found"; end jid = self.config.normalize_jid(jid); + local old_affiliation = node_obj.affiliations[jid]; node_obj.affiliations[jid] = affiliation; + + if self.config.nodestore then + local ok, err = save_node_to_store(self, node_obj); + if not ok then + node_obj.affiliations[jid] = old_affiliation; + return ok, "internal-server-error"; + end + end + local _, jid_sub = self:get_subscription(node, true, jid); if not jid_sub and not self:may(node, jid, "be_unsubscribed") then local ok, err = self:add_subscription(node, true, jid);