mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
modules/webhook: Add issue labels after issue titles.
This commit is contained in:
parent
9ebc536534
commit
a6a509fe4b
1 changed files with 29 additions and 6 deletions
|
@ -477,9 +477,14 @@ static std::ostream &
|
|||
github_handle__issues(std::ostream &out,
|
||||
const json::object &content)
|
||||
{
|
||||
const json::string &action
|
||||
{
|
||||
content["action"]
|
||||
};
|
||||
|
||||
out << " "
|
||||
<< "<b>"
|
||||
<< unquote(content["action"])
|
||||
<< action
|
||||
<< "</b>"
|
||||
;
|
||||
|
||||
|
@ -488,7 +493,7 @@ github_handle__issues(std::ostream &out,
|
|||
content["issue"]
|
||||
};
|
||||
|
||||
switch(hash(unquote(content["action"])))
|
||||
switch(hash(action))
|
||||
{
|
||||
case "assigned"_:
|
||||
case "unassigned"_:
|
||||
|
@ -520,7 +525,25 @@ github_handle__issues(std::ostream &out,
|
|||
<< "</a>"
|
||||
;
|
||||
|
||||
if(unquote(content["action"]) == "opened")
|
||||
if(action != "labeled")
|
||||
for(const json::object &label : json::array(issue["labels"]))
|
||||
{
|
||||
out << " ";
|
||||
out << "<font color=\"#FFFFFF\""
|
||||
<< "data-mx-bg-color=\"#"
|
||||
<< unquote(label["color"])
|
||||
<< "\">";
|
||||
|
||||
out << "<b>";
|
||||
out << " ";
|
||||
out << unquote(label["name"]);
|
||||
out << " ";
|
||||
out << "</b>";
|
||||
|
||||
out << "</font>";
|
||||
}
|
||||
|
||||
if(action == "opened")
|
||||
{
|
||||
out << " "
|
||||
<< "<blockquote>"
|
||||
|
@ -544,7 +567,7 @@ github_handle__issues(std::ostream &out,
|
|||
<< "</blockquote>"
|
||||
;
|
||||
}
|
||||
else if(unquote(content["action"]) == "labeled")
|
||||
else if(action == "labeled")
|
||||
{
|
||||
const json::array labels
|
||||
{
|
||||
|
@ -566,9 +589,9 @@ github_handle__issues(std::ostream &out,
|
|||
<< "\">";
|
||||
|
||||
out << "<b>";
|
||||
out << " ";
|
||||
out << " ";
|
||||
out << unquote(label["name"]);
|
||||
out << " ";
|
||||
out << " ";
|
||||
out << "</b>";
|
||||
|
||||
out << "</font>";
|
||||
|
|
Loading…
Reference in a new issue