From 3943ba0924096e21d83e1670388d53aa4628a7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 2 Jun 2023 18:34:49 +0200 Subject: [PATCH] Attempt at making messages somewhat distinguishable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/webhook.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/webhook.rs b/src/webhook.rs index 946697e..6c42527 100644 --- a/src/webhook.rs +++ b/src/webhook.rs @@ -21,10 +21,10 @@ pub fn format_webhook(wh: &WebHook) -> Option { WebHook::Push(push) => { if push.commits.len() != 0 { let mut text = format!( - "{} pushed {} commits to {} branch {}", + "[{}] {} pushed {} commits branch {}", + push.project.name, push.user_name, push.commits.len(), - push.project.name, push.ref_, ); for commit in &push.commits { @@ -38,10 +38,10 @@ pub fn format_webhook(wh: &WebHook) -> Option { text } else { format!( - "{} deleted branch {} from {}", + "[{}] {} deleted branch {}", + push.project.name, push.user_name, push.ref_, - push.project.name, ) } } @@ -54,11 +54,11 @@ pub fn format_webhook(wh: &WebHook) -> Option { None => return None, }; format!( - "{} {} issue {} in {}: {}{}", + "[{}] {} {} issue {}: {}{}", + issue.project.name, issue.user.name, action, issue.object_attributes.iid, - issue.project.name, issue.object_attributes.title, issue .object_attributes @@ -79,11 +79,11 @@ pub fn format_webhook(wh: &WebHook) -> Option { _ => todo!(), }; format!( - "{} {} merge request {} in {}: {}{}", + "[{}] {} {} merge request {}: {}{}", + merge_req.project.name, merge_req.user.name, action, merge_req.object_attributes.iid, - merge_req.project.name, merge_req.object_attributes.title, merge_req .object_attributes @@ -107,10 +107,10 @@ pub fn format_webhook(wh: &WebHook) -> Option { WikiPageAction::Create => "created", }; format!( - "{} {} {} wiki page {} <{}>", + "[{}] {} {} wiki page {} <{}>", + page.project.name, page.user.name, action, - page.project.name, page.object_attributes.title, page.object_attributes.url, )