Skip to content

Commit eda862f

Browse files
committed
Set comment created_at/updated_at types to support null.
The `review` field of `PullRequestReviewEvent` isn't quite the same as a `Comment`, even though we are pretending they are the same. The `submitted_at` is optional, which was causing deserialization errors. I was inclined to stop treating pull request review comments the same as comments, since their fields don't quite line up. However, that is a much larger change, and generally makes handling pr review comments more awkward.
1 parent c172142 commit eda862f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/github.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ pub struct Comment {
363363
pub body: String,
364364
pub html_url: String,
365365
pub user: User,
366-
#[serde(alias = "submitted_at")] // for pull request reviews
366+
#[serde(default, alias = "submitted_at")] // for pull request reviews
367367
pub created_at: chrono::DateTime<Utc>,
368-
#[serde(alias = "submitted_at")] // for pull request reviews
368+
#[serde(default, alias = "submitted_at")] // for pull request reviews
369369
pub updated_at: chrono::DateTime<Utc>,
370370
#[serde(default, rename = "state")]
371371
pub pr_review_state: Option<PullRequestReviewState>,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub async fn webhook(
185185
payload.pull_request.pull_request = Some(PullRequestDetails::new());
186186

187187
// Treat pull request review comments exactly like pull request
188-
// review comments.
188+
// comments.
189189
github::Event::IssueComment(github::IssueCommentEvent {
190190
action: match payload.action {
191191
github::PullRequestReviewAction::Submitted => {

0 commit comments

Comments
 (0)