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

Display number of commits in tabnav.
dmitshur committed 7 years ago commit dded58d49b7152c79eef268540c369969021345a
Collapse all
changes.go
@@ -36,10 +36,12 @@ type Change struct {
	Title     string
	Labels    []issues.Label
	Author    users.User
	CreatedAt time.Time
	Replies   int // Number of replies to this change (not counting the mandatory change description comment).

	Commits int // Number of commits (not populated during list operation).
}

type Commit struct {
	SHA        string
	Message    string
githubapi/githubapi.go
@@ -165,16 +165,18 @@ func (s service) Get(ctx context.Context, rs string, id uint64) (changes.Change,
		return changes.Change{}, err
	}
	var q struct {
		Repository struct {
			PullRequest struct {
				Number          uint64
				State           githubql.PullRequestState
				Title           string
				Author          githubqlActor
				CreatedAt       githubql.DateTime
				ViewerCanUpdate githubql.Boolean
				Number    uint64
				State     githubql.PullRequestState
				Title     string
				Author    githubqlActor
				CreatedAt githubql.DateTime
				Commits   struct {
					TotalCount int
				}
			} `graphql:"pullRequest(number:$prNumber)"`
		} `graphql:"repository(owner:$repositoryOwner,name:$repositoryName)"`
	}
	variables := map[string]interface{}{
		"repositoryOwner": githubql.String(repo.Owner),
@@ -200,10 +202,11 @@ func (s service) Get(ctx context.Context, rs string, id uint64) (changes.Change,
		ID:        pr.Number,
		State:     ghPRState(pr.State),
		Title:     pr.Title,
		Author:    ghActor(pr.Author),
		CreatedAt: pr.CreatedAt.Time,
		Commits:   pr.Commits.TotalCount,
	}, nil
}

func (s service) ListCommits(ctx context.Context, rs string, id uint64) ([]changes.Commit, error) {
	repo, err := ghRepoSpec(rs)