summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2022-08-04 17:09:44 +0200
committerBadlop <badlop@process-one.net>2022-08-05 16:15:03 +0200
commit72944d895b9f5004a83b870ba8a4c82c39c84dff (patch)
tree269c647794ec7256f4b2a298182b48ec338ad999 /src
parentShow allow_query_users room option in disco info (#3830) (diff)
ext_mod: Handle correctly when COMMIT.json not found
Diffstat (limited to 'src')
-rw-r--r--src/ext_mod.erl22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/ext_mod.erl b/src/ext_mod.erl
index 7058cd7a..8ff4015d 100644
--- a/src/ext_mod.erl
+++ b/src/ext_mod.erl
@@ -805,10 +805,11 @@ get_commit_details2(Path) ->
{ok, Body} ->
parse_details(Body);
_ ->
- #{sha => <<"1234567890">>,
+ #{sha => unknown_sha,
date => <<>>,
message => <<>>,
html => <<>>,
+ author_name => <<>>,
commit_html_url => <<>>}
end.
@@ -891,8 +892,10 @@ get_installed_module_el({ModAtom, Attrs}, Lang) ->
Summary = list_to_binary(get_module_summary(Attrs)),
Author = list_to_binary(get_module_author(Attrs)),
{_, FromPath} = lists:keyfind(path, 1, Attrs),
- {ok, FromFile} = find_commit_json_path(FromPath),
-
+ FromFile = case find_commit_json_path(FromPath) of
+ {ok, FF} -> FF;
+ {error, _} -> "dummypath"
+ end,
#{sha := CommitSha,
date := CommitDate,
message := CommitMessage,
@@ -925,7 +928,7 @@ get_installed_module_el({ModAtom, Attrs}, Lang) ->
Started =
case gen_mod:is_loaded(hd(ejabberd_option:hosts()), ModAtom) of
false ->
- [?C(<<" - ">>)];
+ [?C(<<" ">>)];
true ->
[]
end,
@@ -942,8 +945,8 @@ get_installed_module_el({ModAtom, Attrs}, Lang) ->
?XE(<<"td">>,
[?INPUTTD(<<"checkbox">>, <<"selected_uninstall">>, Mod),
?C(<<" ">>),
- ?AXC(CommitHtmlUrl, [TitleEl], binary:part(CommitSha, {0, 8})),
- ?C(<<" ">>)]
+ get_commit_link(CommitHtmlUrl, TitleEl, CommitSha),
+ ?C(<<" - ">>)]
++ Started
++ Status)
| UpgradeEls]).
@@ -1006,6 +1009,11 @@ make_home_title_el(Summary, Author) ->
LinkTitle = <<Summary/binary, "\n", Author/binary>>,
{<<"title">>, LinkTitle}.
+get_commit_link(_CommitHtmlUrl, _TitleErl, unknown_sha) ->
+ ?C(<<"Please Update Specs">>);
+get_commit_link(CommitHtmlUrl, TitleEl, CommitSha) ->
+ ?AXC(CommitHtmlUrl, [TitleEl], binary:part(CommitSha, {0, 8})).
+
get_content(Node, Query, Lang) ->
Instruct = translate:translate(Lang, ?T("Type a command in a textbox and click Execute.")),
{{_CommandCtl}, _Res} =
@@ -1034,7 +1042,7 @@ get_content(Node, Query, Lang) ->
?XE(<<"tr">>,
[?XE(<<"td">>, [?AC(Html, Dirname)]),
?XE(<<"td">>,
- [?AXC(CommitHtmlUrl, [TitleEl], binary:part(CommitSha, {0, 8}))]
+ [get_commit_link(CommitHtmlUrl, TitleEl, CommitSha)]
),
?XE(<<"td">>, [?C(CommitMessage)])
])