Use iid field (and not id) field for the correct issue ID

This commit is contained in:
Brian Tarricone 2023-09-20 18:17:27 -07:00
parent b33935b5f8
commit 3f42a08bcb

View File

@ -185,7 +185,7 @@ impl fmt::Display for IssueAction {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct IssueObjectAttributes { pub struct IssueObjectAttributes {
pub id: u32, pub iid: u32,
pub title: String, pub title: String,
pub action: IssueAction, pub action: IssueAction,
pub url: String, pub url: String,
@ -406,7 +406,7 @@ impl GitlabEventExt for GitlabEvent {
if object_attributes.action != IssueAction::Other { if object_attributes.action != IssueAction::Other {
let title = format!( let title = format!(
"Issue #{} **{}**: {}", "Issue #{} **{}**: {}",
object_attributes.id, object_attributes.action, object_attributes.title object_attributes.iid, object_attributes.action, object_attributes.title
); );
vec![markdown_link(&title, &object_attributes.url)] vec![markdown_link(&title, &object_attributes.url)]
} else { } else {
@ -587,7 +587,7 @@ mod test {
.. ..
} => { } => {
assert_eq!(user.name, "Administrator"); assert_eq!(user.name, "Administrator");
assert_eq!(object_attributes.id, 301); assert_eq!(object_attributes.iid, 23);
assert_eq!(object_attributes.action, IssueAction::Open); assert_eq!(object_attributes.action, IssueAction::Open);
} }
_ => panic!("not an issue event"), _ => panic!("not an issue event"),