25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix num_subscribers on node metadata (#2122)

This commit is contained in:
Christophe Romain 2017-11-30 15:27:34 +01:00
parent 8639da0e00
commit a5849a0dab

View File

@ -939,14 +939,18 @@ node_disco_info(Host, Node, _From, _Identity, _Features) ->
_ -> <<"leaf">>
end,
Affs = case node_call(Host, Type, get_node_affiliations, [Nidx]) of
{result, Result} -> Result;
{result, As} -> As;
_ -> []
end,
Subs = case node_call(Host, Type, get_node_subscriptions, [Nidx]) of
{result, Ss} -> Ss;
_ -> []
end,
Meta = [{title, get_option(Options, title, <<>>)},
{description, get_option(Options, description, <<>>)},
{owner, [jid:make(LJID) || {LJID, Aff} <- Affs, Aff =:= owner]},
{publisher, [jid:make(LJID) || {LJID, Aff} <- Affs, Aff =:= publisher]},
{num_subscribers, length([LJID || {LJID, Aff} <- Affs, Aff =:= subscriber])}],
{num_subscribers, length(Subs)}],
XData = #xdata{type = result,
fields = pubsub_meta_data:encode(Meta)},
Is = [#identity{category = <<"pubsub">>, type = NodeType}],