aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2020-03-16 13:29:05 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2020-03-16 13:29:05 +0100
commit6fe7c5cac59e1aee8f2a0f04bae0ace630241ce4 (patch)
tree095e81dcf22aa5de8bc9c4686a4d24123daece07 /src
parentPass base path instead of level to support URL missing slash (#3177) (diff)
Try to limit calls to groups_with_opts in mod_shared_roster
Diffstat (limited to 'src')
-rw-r--r--src/mod_shared_roster.erl22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index 676ca4570..289a44241 100644
--- a/src/mod_shared_roster.erl
+++ b/src/mod_shared_roster.erl
@@ -419,16 +419,7 @@ get_online_users(Host) ->
get_group_users(Host1, Group1) ->
{Host, Group} = split_grouphost(Host1, Group1),
- case get_group_opt(Host, Group, all_users, false) of
- true -> ejabberd_auth:get_users(Host);
- false -> []
- end
- ++
- case get_group_opt(Host, Group, online_users, false) of
- true -> get_online_users(Host);
- false -> []
- end
- ++ get_group_explicit_users(Host, Group).
+ get_group_users(Host, Group, get_group_opts(Host, Group)).
get_group_users(Host, Group, GroupOpts) ->
case proplists:get_value(all_users, GroupOpts, false) of
@@ -573,9 +564,7 @@ add_user_to_group2(Host, US, Group) ->
end.
get_displayed_groups(Group, LServer) ->
- GroupsOpts = groups_with_opts(LServer),
- GroupOpts = proplists:get_value(Group, GroupsOpts, []),
- proplists:get_value(displayed_groups, GroupOpts, []).
+ get_group_opt(LServer, Group, displayed_groups, []).
push_displayed_to_user(LUser, LServer, Host, Subscription, DisplayedGroups) ->
[push_members_to_user(LUser, LServer, DGroup, Host,
@@ -610,8 +599,7 @@ remove_user_from_group(Host, US, Group) ->
push_members_to_user(LUser, LServer, Group, Host,
Subscription) ->
- GroupsOpts = groups_with_opts(LServer),
- GroupOpts = proplists:get_value(Group, GroupsOpts, []),
+ GroupOpts = get_group_opts(LServer, Group),
GroupName = proplists:get_value(name, GroupOpts, Group),
Members = get_group_users(Host, Group),
lists:foreach(fun ({U, S}) ->
@@ -659,9 +647,7 @@ push_user_to_members(User, Server, Subscription) ->
lists:usort(SpecialGroups ++ UserGroups)).
push_user_to_displayed(LUser, LServer, Group, Host, Subscription, DisplayedToGroupsOpts) ->
- GroupsOpts = groups_with_opts(Host),
- GroupOpts = proplists:get_value(Group, GroupsOpts, []),
- GroupName = proplists:get_value(name, GroupOpts, Group),
+ GroupName = get_group_opt(Host, Group, name, Group),
[push_user_to_group(LUser, LServer, GroupD, Host,
GroupName, Subscription)
|| GroupD <- DisplayedToGroupsOpts].