diff --git a/src/hooks/forgejo.rs b/src/hooks/forgejo.rs index d1defc3..47b9bad 100644 --- a/src/hooks/forgejo.rs +++ b/src/hooks/forgejo.rs @@ -77,6 +77,7 @@ impl From for Note { .comment .map(|c| c.html_url) .unwrap_or(other.issue.html_url), + is_update: other.action == FjIssueAction::Edited, } } } diff --git a/src/hooks/mod.rs b/src/hooks/mod.rs index 68bf6c1..3a2fce3 100644 --- a/src/hooks/mod.rs +++ b/src/hooks/mod.rs @@ -109,19 +109,26 @@ pub fn format_hook(hook: &Hook) -> Option { if note.snippet { return None; } + + let updated_fmt = if note.is_update { + "updated comment" + } else { + "commented" + }; + if let Some(commit) = ¬e.commit { format!( - "[{}] {} commented on commit {:?} <{}>", + "[{}] {} {updated_fmt} on commit {:?} <{}>", note.repository.name, note.author.name, commit.ref_, commit.url, ) } else if let Some(issue) = ¬e.issue { format!( - "[{}] {} commented on issue {}: {} <{}>", + "[{}] {} {updated_fmt} on issue {}: {} <{}>", note.repository.name, note.author.name, issue.id, issue.title, note.url, ) } else if let Some(mr) = ¬e.merge_request { format!( - "[{}] {} commented on merge request {}: {} <{}>", + "[{}] {} {updated_fmt} on merge request {}: {} <{}>", note.repository.name, note.author.name, mr.id, mr.title, note.url, ) } else { diff --git a/src/hooks/types.rs b/src/hooks/types.rs index 6525fe2..b828ebe 100644 --- a/src/hooks/types.rs +++ b/src/hooks/types.rs @@ -116,6 +116,7 @@ pub struct Note { pub repository: Repository, pub author: User, pub url: String, + pub is_update: bool, } #[derive(Debug, Clone, PartialEq)]