fix formatting and links of user reports more

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-01-17 13:16:00 -05:00 committed by June
parent 6063a671c3
commit 40f5345586

View file

@ -72,29 +72,35 @@ pub async fn report_event_route(
}; };
// send admin room message that we received the report with an @room ping for urgency // send admin room message that we received the report with an @room ping for urgency
services().admin services()
.admin
.send_message(message::RoomMessageEventContent::text_html( .send_message(message::RoomMessageEventContent::text_html(
format!( format!(
"@room Report received from: {}\n\n\ "@room Report received from: {}\n\n\
Event ID: {:?}\n\ Event ID: {}\n\
Room ID: {:?}\n\ Room ID: {}\n\
Sent By: {:?}\n\n\ Sent By: {}\n\n\
Report Score: {:#?}\n\ Report Score: {}\n\
Report Reason: {:?}", Report Reason: {}",
sender_user.to_owned(), pdu.event_id, pdu.room_id, pdu.sender, body.score, body.reason
),
format!(
"<details><summary>@room Report received from: <a href=\"https://matrix.to/#/{0}\">{0}\
</a></summary><ul><li>Event Info<ul><li>Event ID: <code>{1:?}</code>\
<a href=\"https://matrix.to/#/{2:?}/{1:?}\">🔗</a></li><li>Room ID: <code>{2:?}</code>\
</li><li>Sent By: <a href=\"https://matrix.to/#/{3:?}\">{3:?}</a></li></ul></li><li>\
Report Info<ul><li>Report Score: {4:?}</li><li>Report Reason: {5}</li></ul></li>\
</ul></details>",
sender_user.to_owned(), sender_user.to_owned(),
pdu.event_id, pdu.event_id,
pdu.room_id, pdu.room_id,
pdu.sender, pdu.sender.to_owned(),
body.score, body.score.unwrap_or(ruma::Int::from(0)),
body.reason.as_deref().unwrap_or("")
),
format!(
"<details><summary>@room Report received from: <a href=\"https://matrix.to/#/{0}\">{0}\
</a></summary><ul><li>Event Info<ul><li>Event ID: <code>{1}</code>\
<a href=\"https://matrix.to/#/{2}/{1}\">🔗</a></li><li>Room ID: <code>{2}</code>\
</li><li>Sent By: <a href=\"https://matrix.to/#/{3}\">{3}</a></li></ul></li><li>\
Report Info<ul><li>Report Score: {4}</li><li>Report Reason: {5}</li></ul></li>\
</ul></details>",
sender_user.to_owned(),
pdu.event_id.to_owned(),
pdu.room_id.to_owned(),
pdu.sender.to_owned(),
body.score.unwrap_or(ruma::Int::from(0)),
HtmlEscape(body.reason.as_deref().unwrap_or("")) HtmlEscape(body.reason.as_deref().unwrap_or(""))
), ),
)); ));