Skip to content

Commit

Permalink
Fix feature: Add support to generate link to room page
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed Jun 6, 2024
1 parent f5b0771 commit 30ff6c8
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/ejabberd_web_admin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ when
| {result_links, [
{
ResultName :: atom(),
LinkType :: host | node | user | arg_host | paragraph,
LinkType :: host | node | user | room | arg_host | paragraph,
Level :: integer(),
Append :: binary()
}
Expand Down Expand Up @@ -1701,7 +1701,7 @@ when
| {result_links, [
{
ResultName :: atom(),
LinkType :: host | node | user | arg_host | paragraph,
LinkType :: host | node | user | room | arg_host | paragraph,
Level :: integer(),
Append :: binary()
}
Expand Down Expand Up @@ -2262,6 +2262,23 @@ make_result(Binary, ElementName, _ArgumentsUsed, [{ResultName, user, Level, Appe
false ->
?C(Binary)
end;
make_result(Binary, ElementName, _ArgumentsUsed, [{ResultName, room, Level, Append}]) when
(ElementName == ResultName) or (ElementName == unknown_element_name)
->
Jid = jid:decode(Binary),
{Roomname, Service, _} = jid:split(Jid),
Host = ejabberd_router:host_of_route(Service),
case lists:member(Host, ejabberd_config:get_option(hosts)) of
true ->
UrlBinary = replace_url_elements(
[<<"server/">>, host, <<"/muc/rooms/room/">>, room, <<"/">>, Append],
[{room, misc:url_encode(Roomname)}, {host, Host}],
Level
),
?AC(UrlBinary, Binary);
false ->
?C(Binary)
end;
make_result(Binary, ElementName, _ArgumentsUsed, [{ResultName, shared_roster, Level, Append}]) when
(ElementName == ResultName) or (ElementName == unknown_element_name)
->
Expand Down

0 comments on commit 30ff6c8

Please sign in to comment.