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