25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Fix roster_tests:get_items

This commit is contained in:
Alexey Shchepin 2021-09-21 13:30:52 +03:00
parent bf068f5659
commit c9c5839da4

View File

@ -224,13 +224,21 @@ get_items(Config, Version) ->
sub_els = [#roster_query{ver = Version}]}) of sub_els = [#roster_query{ver = Version}]}) of
#iq{type = result, #iq{type = result,
sub_els = [#roster_query{ver = NewVersion, items = Items}]} -> sub_els = [#roster_query{ver = NewVersion, items = Items}]} ->
{NewVersion, Items}; {NewVersion, normalize_items(Items)};
#iq{type = result, sub_els = []} -> #iq{type = result, sub_els = []} ->
{empty, []}; {empty, []};
#iq{type = error} = Err -> #iq{type = error} = Err ->
xmpp:get_error(Err) xmpp:get_error(Err)
end. end.
normalize_items(Items) ->
Items2 =
lists:map(
fun(I) ->
I#roster_item{groups = lists:sort(I#roster_item.groups)}
end, Items),
lists:sort(Items2).
get_item(Config, JID) -> get_item(Config, JID) ->
case get_items(Config) of case get_items(Config) of
{_Ver, Items} when is_list(Items) -> {_Ver, Items} when is_list(Items) ->