]> granicus.if.org Git - ejabberd/commitdiff
Remove items of unregistered user (#2129)
authorChristophe Romain <christophe.romain@process-one.net>
Thu, 22 Mar 2018 10:59:24 +0000 (11:59 +0100)
committerChristophe Romain <christophe.romain@process-one.net>
Thu, 22 Mar 2018 10:59:24 +0000 (11:59 +0100)
src/mod_pubsub.erl

index 666ea41ee83a6d7f7682ff63b218081fe94eae67..fc942ff794d3f63c134ce82628759fdd7046253c 100644 (file)
@@ -685,12 +685,17 @@ remove_user(User, Server) ->
                                    ({#pubsub_node{nodeid = {H, N}, type = Type}, owner})
                                            when N == HomeTreeBase, Type == <<"hometree">> ->
                                        delete_node(H, N, Entity);
-                                   ({#pubsub_node{id = Nidx}, publisher}) ->
+                                   ({#pubsub_node{id = Nidx}, _}) ->
+                                       {result, State} = node_action(Host, PType,
+                                                       get_state,
+                                                       [Nidx, jid:tolower(Entity)]),
+                                       ItemIds = State#pubsub_state.items,
                                        node_action(Host, PType,
-                                           set_affiliation,
-                                           [Nidx, Entity, none]);
-                                   (_) ->
-                                       ok
+                                                   remove_extra_items,
+                                                   [Nidx, 0, ItemIds]),
+                                       node_action(Host, PType,
+                                                   set_affiliation,
+                                                   [Nidx, Entity, none])
                                end,
                                Affs)
                    end,