dmitri.shuralyov.com/service/change/...

Add support for review request removed event.
dmitshur committed 7 years ago commit 3a41280277cd11be7f5d5e69f186e8ff843b3b2e
Collapse all
githubapi/githubapi.go
@@ -454,10 +454,16 @@ func (s service) ListEvents(ctx context.Context, rs string, id uint64, opt *chan
							event
							RequestedReviewer struct {
								githubqlActor `graphql:"...on Actor"`
							}
						} `graphql:"...on ReviewRequestedEvent"`
						ReviewRequestRemovedEvent struct {
							event
							RequestedReviewer struct {
								githubqlActor `graphql:"...on Actor"`
							}
						} `graphql:"...on ReviewRequestRemovedEvent"`
					}
				} `graphql:"timeline(first:100)"` // TODO: Paginate?
			} `graphql:"pullRequest(number:$prNumber)"`
		} `graphql:"repository(owner:$repositoryOwner,name:$repositoryName)"`
	}
@@ -511,10 +517,15 @@ func (s service) ListEvents(ctx context.Context, rs string, id uint64, opt *chan
		case "ReviewRequestedEvent":
			e.Actor = ghActor(event.ReviewRequestedEvent.Actor)
			e.CreatedAt = event.ReviewRequestedEvent.CreatedAt.Time
			// TODO: Move RequestedReviewer field to changes-only events (it doesn't apply to issues).
			e.RequestedReviewer = ghActor(event.ReviewRequestedEvent.RequestedReviewer.githubqlActor)
		case "ReviewRequestRemovedEvent":
			e.Actor = ghActor(event.ReviewRequestRemovedEvent.Actor)
			e.CreatedAt = event.ReviewRequestRemovedEvent.CreatedAt.Time
			// TODO: Move RequestedReviewer field to changes-only events (it doesn't apply to issues).
			e.RequestedReviewer = ghActor(event.ReviewRequestRemovedEvent.RequestedReviewer.githubqlActor)
		default:
			continue
		}
		events = append(events, e)
	}