mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
Merge pull request #1793 from marcphilipp/bugfix/set_room_affiliation_master
Fix mod_muc_admin:set_room_affiliation
This commit is contained in:
commit
54e6e1a5fb
2 changed files with 11 additions and 4 deletions
|
@ -1012,7 +1012,7 @@ set_room_affiliation(Name, Service, JID, AffiliationString) ->
|
||||||
case mod_muc:find_online_room(Name, Service) of
|
case mod_muc:find_online_room(Name, Service) of
|
||||||
{ok, Pid} ->
|
{ok, Pid} ->
|
||||||
%% Get the PID for the online room so we can get the state of the room
|
%% Get the PID for the online room so we can get the state of the room
|
||||||
{ok, StateData} = gen_fsm:sync_send_all_state_event(Pid, {process_item_change, {jid:decode(JID), affiliation, Affiliation, <<"">>}, <<"">>}),
|
{ok, StateData} = gen_fsm:sync_send_all_state_event(Pid, {process_item_change, {jid:decode(JID), affiliation, Affiliation, <<"">>}, undefined}),
|
||||||
mod_muc:store_room(StateData#state.server_host, StateData#state.host, StateData#state.room, make_opts(StateData)),
|
mod_muc:store_room(StateData#state.server_host, StateData#state.host, StateData#state.room, make_opts(StateData)),
|
||||||
ok;
|
ok;
|
||||||
error ->
|
error ->
|
||||||
|
|
|
@ -2608,7 +2608,7 @@ process_item_change(UJID) ->
|
||||||
-type admin_action() :: {jid(), affiliation | role,
|
-type admin_action() :: {jid(), affiliation | role,
|
||||||
affiliation() | role(), binary()}.
|
affiliation() | role(), binary()}.
|
||||||
|
|
||||||
-spec process_item_change(admin_action(), state(), jid()) -> state() | {error, stanza_error()}.
|
-spec process_item_change(admin_action(), state(), undefined | jid()) -> state() | {error, stanza_error()}.
|
||||||
process_item_change(Item, SD, UJID) ->
|
process_item_change(Item, SD, UJID) ->
|
||||||
try case Item of
|
try case Item of
|
||||||
{JID, affiliation, owner, _} when JID#jid.luser == <<"">> ->
|
{JID, affiliation, owner, _} when JID#jid.luser == <<"">> ->
|
||||||
|
@ -2658,8 +2658,15 @@ process_item_change(Item, SD, UJID) ->
|
||||||
SD1
|
SD1
|
||||||
end
|
end
|
||||||
catch E:R ->
|
catch E:R ->
|
||||||
?ERROR_MSG("failed to set item ~p from ~s: ~p",
|
FromSuffix = case UJID of
|
||||||
[Item, jid:encode(UJID),
|
#jid{} ->
|
||||||
|
JidString = jid:encode(UJID),
|
||||||
|
<<" from ", JidString/binary>>;
|
||||||
|
undefined ->
|
||||||
|
<<"">>
|
||||||
|
end,
|
||||||
|
?ERROR_MSG("failed to set item ~p~s: ~p",
|
||||||
|
[Item, FromSuffix,
|
||||||
{E, {R, erlang:get_stacktrace()}}]),
|
{E, {R, erlang:get_stacktrace()}}]),
|
||||||
{error, xmpp:err_internal_server_error()}
|
{error, xmpp:err_internal_server_error()}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue