Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

return repo language in repo list #56

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/app/providers/implementations/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func parseGithubRepository(r *github.Repository, root bool) *provider.Repo {
DefaultBranch: r.GetDefaultBranch(),
Source: source,
StargazersCount: r.GetStargazersCount(),
Language: r.GetLanguage(),
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/app/providers/provider/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Repo struct {
Source *Repo

StargazersCount int
Language string
}

type Branch struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/app/returntypes/returntypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type RepoInfo struct {
IsPrivate bool `json:"isPrivate,omitempty"`
IsCreating bool `json:"isCreating,omitempty"`
IsDeleting bool `json:"isDeleting,omitempty"`
Language string `json:"language,omitempty"`
}

type WrappedRepoInfo struct {
Expand Down
3 changes: 2 additions & 1 deletion pkg/app/services/repo/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ func (s BasicService) List(rc *request.AuthorizedContext, req *listRequest) (*re
Organization: strings.Split(pr.Name, "/")[0],
IsAdmin: pr.IsAdmin,
IsPrivate: pr.IsPrivate,
Language: pr.Language,
}

if ar, ok := activatedRepos[pr.ID]; pr.ID != 0 && ok {
Expand All @@ -354,7 +355,7 @@ func (s BasicService) List(rc *request.AuthorizedContext, req *listRequest) (*re

func (s BasicService) fetchProviderReposCached(rc *request.AuthorizedContext, useCache bool, p provider.Provider) ([]provider.Repo, error) {
const maxPages = 20
key := fmt.Sprintf("repos/%s/fetch?user_id=%d&maxPage=%d&v=4", p.Name(), rc.Auth.UserID, maxPages)
key := fmt.Sprintf("repos/%s/fetch?user_id=%d&maxPage=%d&v=5", p.Name(), rc.Auth.UserID, maxPages)
if rc.Auth.PrivateAccessToken != "" {
key += "&private=true"
}
Expand Down