25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Fix type of computed field in node_flat sql query

This commit is contained in:
Paweł Chmielowski 2020-03-18 14:04:40 +01:00
parent 0a88d03dc9
commit 2d707cc0d2

View File

@ -896,14 +896,13 @@ select_affiliation_subscriptions(Nidx, JID, JID) ->
select_affiliation_subscriptions(Nidx, GenKey, SubKey) -> select_affiliation_subscriptions(Nidx, GenKey, SubKey) ->
GJ = encode_jid(GenKey), GJ = encode_jid(GenKey),
SJ = encode_jid(SubKey), SJ = encode_jid(SubKey),
case catch case catch ejabberd_sql:sql_query_t(
ejabberd_sql:sql_query_t( ?SQL("select jid = %(GJ)s as @(G)b, @(affiliation)s, @(subscriptions)s from "
?SQL("select jid = %(GJ)s as @(G)d, @(affiliation)s, @(subscriptions)s from " " pubsub_state where nodeid=%(Nidx)d and jid in (%(GJ)s, %(SJ)s)"))
" pubsub_state where nodeid=%(Nidx)d and jid in (%(GJ)s, %(SJ)s)"))
of of
{selected, Res} -> {selected, Res} ->
lists:foldr( lists:foldr(
fun({1, A, S}, {_, Subs}) -> fun({true, A, S}, {_, Subs}) ->
{decode_affiliation(A), Subs ++ decode_subscriptions(S)}; {decode_affiliation(A), Subs ++ decode_subscriptions(S)};
({_, _, S}, {Aff, Subs}) -> ({_, _, S}, {Aff, Subs}) ->
{Aff, Subs ++ decode_subscriptions(S)} {Aff, Subs ++ decode_subscriptions(S)}