mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-03-25 09:25:49 +00:00
Include organization repos in the digest.
This commit is contained in:
parent
221a084baf
commit
c0375fdb37
2 changed files with 27 additions and 4 deletions
13
TODO
13
TODO
|
|
@ -1,9 +1,14 @@
|
|||
Notes:
|
||||
- Option to disable HTTP request cache (or at least expire user/organization queries)
|
||||
- Will need to get/store timezone of user (use https://bitbucket.org/pellepim/jstimezonedetect, use it with time.Location.LoadLocation)
|
||||
- To get digests for non-user owned organizations, will need to list the organizations and their repositories
|
||||
TODO
|
||||
- Handle pagination for repository list
|
||||
- Handle pagination for commit list
|
||||
- Digests for activity every year going back to the oldest repository
|
||||
- List all repostories that were included in the the search in a footer of the template
|
||||
- Option to disable HTTP request cache (or at least expire user/organization queries)
|
||||
- Weekly vs. daily option
|
||||
|
||||
Notes:
|
||||
- Will need to get/store timezone of user (use https://bitbucket.org/pellepim/jstimezonedetect, use it with time.Location.LoadLocation)
|
||||
- To get digests for non-user owned organizations, will need to list the organizations and their repositories
|
||||
- To make a raw HTTP request with the github package:
|
||||
httpReq, _ := githubClient.NewRequest("GET", "user/teams", nil)
|
||||
var jsonResp interface{}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,24 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
orgs, _, err := githubClient.Organizations.List("", nil)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
for _, org := range orgs {
|
||||
orgRepos, _, err := githubClient.Repositories.ListByOrg(*org.Login, nil)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
newRepos := make([]github.Repository, len(repos) + len(orgRepos))
|
||||
copy(newRepos, repos)
|
||||
copy(newRepos[len(repos):], orgRepos)
|
||||
repos = newRepos
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
digestStartTime := time.Date(now.Year()-1, now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||
digestEndTime := digestStartTime.AddDate(0, 0, 7)
|
||||
|
|
|
|||
Loading…
Reference in a new issue