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

ban_account/unban: When mod_private is disabled, return meaningful error (#4201)

This commit is contained in:
Badlop 2024-04-29 17:17:06 +02:00
parent 395a73bbe0
commit 0da767f568

View File

@ -1069,11 +1069,16 @@ prepare_reason(Reason) when is_binary(Reason) ->
%% Ban account v2 %% Ban account v2
ban_account_v2(User, Host, ReasonText) -> ban_account_v2(User, Host, ReasonText) ->
case is_banned(User, Host) of case gen_mod:is_loaded(Host, mod_private) of
true ->
account_was_already_banned;
false -> false ->
ban_account_v2_b(User, Host, ReasonText) mod_private_is_required_but_disabled;
true ->
case is_banned(User, Host) of
true ->
account_was_already_banned;
false ->
ban_account_v2_b(User, Host, ReasonText)
end
end. end.
ban_account_v2_b(User, Host, ReasonText) -> ban_account_v2_b(User, Host, ReasonText) ->
@ -1161,11 +1166,16 @@ is_banned(User, Host) ->
%% Unban account %% Unban account
unban_account(User, Host) -> unban_account(User, Host) ->
case is_banned(User, Host) of case gen_mod:is_loaded(Host, mod_private) of
false -> false ->
account_was_not_banned; mod_private_is_required_but_disabled;
true -> true ->
unban_account2(User, Host) case is_banned(User, Host) of
false ->
account_was_not_banned;
true ->
unban_account2(User, Host)
end
end. end.
unban_account2(User, Host) -> unban_account2(User, Host) ->