From c0a2b386a4cc0ddc85050499c0cd1e9589532ae4 Mon Sep 17 00:00:00 2001 From: Matt Simons Date: Wed, 24 Jul 2024 13:52:36 +0100 Subject: [PATCH] Revert "Add CommitID, InReplyTo, and SubjectType to DraftReviewComment (#3169)" This reverts commit 06c97092155a2ecabd86d4db38b6bb4354e4e420. --- github/github-accessors.go | 24 ------------------------ github/github-accessors_test.go | 30 ------------------------------ github/github-stringify_test.go | 21 +++++++++------------ github/pulls_reviews.go | 9 +++------ 4 files changed, 12 insertions(+), 72 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 9a96c8ebe0..02f33be381 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6606,22 +6606,6 @@ func (d *DraftReviewComment) GetBody() string { return *d.Body } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetCommitID() string { - if d == nil || d.CommitID == nil { - return "" - } - return *d.CommitID -} - -// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetInReplyTo() int64 { - if d == nil || d.InReplyTo == nil { - return 0 - } - return *d.InReplyTo -} - // GetLine returns the Line field if it's non-nil, zero value otherwise. func (d *DraftReviewComment) GetLine() int { if d == nil || d.Line == nil { @@ -6670,14 +6654,6 @@ func (d *DraftReviewComment) GetStartSide() string { return *d.StartSide } -// GetSubjectType returns the SubjectType field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetSubjectType() string { - if d == nil || d.SubjectType == nil { - return "" - } - return *d.SubjectType -} - // GetRef returns the Ref field. func (e *EditBase) GetRef() *EditRef { if e == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c8c2e511b2..5ed9236412 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -7727,26 +7727,6 @@ func TestDraftReviewComment_GetBody(tt *testing.T) { d.GetBody() } -func TestDraftReviewComment_GetCommitID(tt *testing.T) { - var zeroValue string - d := &DraftReviewComment{CommitID: &zeroValue} - d.GetCommitID() - d = &DraftReviewComment{} - d.GetCommitID() - d = nil - d.GetCommitID() -} - -func TestDraftReviewComment_GetInReplyTo(tt *testing.T) { - var zeroValue int64 - d := &DraftReviewComment{InReplyTo: &zeroValue} - d.GetInReplyTo() - d = &DraftReviewComment{} - d.GetInReplyTo() - d = nil - d.GetInReplyTo() -} - func TestDraftReviewComment_GetLine(tt *testing.T) { var zeroValue int d := &DraftReviewComment{Line: &zeroValue} @@ -7807,16 +7787,6 @@ func TestDraftReviewComment_GetStartSide(tt *testing.T) { d.GetStartSide() } -func TestDraftReviewComment_GetSubjectType(tt *testing.T) { - var zeroValue string - d := &DraftReviewComment{SubjectType: &zeroValue} - d.GetSubjectType() - d = &DraftReviewComment{} - d.GetSubjectType() - d = nil - d.GetSubjectType() -} - func TestEditBase_GetRef(tt *testing.T) { e := &EditBase{} e.GetRef() diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index c311889c28..8633d837d1 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -388,18 +388,15 @@ func TestDiscussionComment_String(t *testing.T) { func TestDraftReviewComment_String(t *testing.T) { v := DraftReviewComment{ - Path: String(""), - Position: Int(0), - Body: String(""), - CommitID: String(""), - InReplyTo: Int64(0), - SubjectType: String(""), - StartSide: String(""), - Side: String(""), - StartLine: Int(0), - Line: Int(0), - } - want := `github.DraftReviewComment{Path:"", Position:0, Body:"", CommitID:"", InReplyTo:0, SubjectType:"", StartSide:"", Side:"", StartLine:0, Line:0}` + Path: String(""), + Position: Int(0), + Body: String(""), + StartSide: String(""), + Side: String(""), + StartLine: Int(0), + Line: Int(0), + } + want := `github.DraftReviewComment{Path:"", Position:0, Body:"", StartSide:"", Side:"", StartLine:0, Line:0}` if got := v.String(); got != want { t.Errorf("DraftReviewComment.String = %v, want %v", got, want) } diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index 28450c3d43..27b8dc37d5 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -35,12 +35,9 @@ func (p PullRequestReview) String() string { // DraftReviewComment represents a comment part of the review. type DraftReviewComment struct { - Path *string `json:"path,omitempty"` - Position *int `json:"position,omitempty"` - Body *string `json:"body,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - InReplyTo *int64 `json:"in_reply_to,omitempty"` - SubjectType *string `json:"subject_type,omitempty"` + Path *string `json:"path,omitempty"` + Position *int `json:"position,omitempty"` + Body *string `json:"body,omitempty"` // The new comfort-fade-preview fields StartSide *string `json:"start_side,omitempty"`