Skip to content

Commit 349bce4

Browse files
authored
Merge pull request #2147 from Urgau/comment-updated_at
Fix error about duplicated entry for `updated_at` in pull request review events
2 parents 45ee058 + d6deb51 commit 349bce4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/github.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,10 @@ pub struct Comment {
470470
pub body: String,
471471
pub html_url: String,
472472
pub user: User,
473-
#[serde(default, alias = "submitted_at")] // for pull request reviews
474-
pub updated_at: chrono::DateTime<Utc>,
473+
#[serde(default, alias = "submitted_at")] // for pull-request review comments
474+
pub created_at: Option<chrono::DateTime<Utc>>,
475+
#[serde(default)]
476+
pub updated_at: Option<chrono::DateTime<Utc>>,
475477
#[serde(default, rename = "state")]
476478
pub pr_review_state: Option<PullRequestReviewState>,
477479
pub author_association: AuthorAssociation,
@@ -2402,7 +2404,11 @@ impl Event {
24022404
match self {
24032405
Event::Create(_) => None,
24042406
Event::Issue(e) => Some(e.issue.created_at.into()),
2405-
Event::IssueComment(e) => Some(e.comment.updated_at.into()),
2407+
Event::IssueComment(e) => e
2408+
.comment
2409+
.updated_at
2410+
.or(e.comment.created_at)
2411+
.map(Into::into),
24062412
Event::Push(_) => None,
24072413
}
24082414
}

0 commit comments

Comments
 (0)