From 288cfdbb59891d535678c55a4db249b4501efc3f Mon Sep 17 00:00:00 2001 From: Elliott Stoneham Date: Wed, 24 Aug 2016 15:25:16 +0100 Subject: [PATCH] remove commented-out code, add Private flags, fix noMilestone names --- .../components/section/github/type-editor.js | 240 ------------------ core/section/github/commits.go | 3 +- core/section/github/github.go | 1 - core/section/github/issuenum.go | 217 ---------------- core/section/github/issues.go | 10 +- core/section/github/lists.go | 100 -------- core/section/github/milestones.go | 4 +- core/section/github/model.go | 29 +-- core/section/github/pullrequests.go | 196 -------------- 9 files changed, 8 insertions(+), 792 deletions(-) delete mode 100644 core/section/github/issuenum.go delete mode 100644 core/section/github/pullrequests.go diff --git a/app/app/components/section/github/type-editor.js b/app/app/components/section/github/type-editor.js index 3d8fe094..4a0aeefd 100644 --- a/app/app/components/section/github/type-editor.js +++ b/app/app/components/section/github/type-editor.js @@ -112,10 +112,8 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, getOwnerLists() { this.set('busy', true); - //let self = this; let owners = this.get('owners'); let thisOwner = this.get('config.owner'); - //let page = this.get('page'); if (is.null(thisOwner) || is.undefined(thisOwner)) { if (owners.length) { @@ -128,19 +126,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, this.set('owner', thisOwner); - /* - this.get('sectionService').fetch(page, "repos", self.get('config')) - .then(function (lists) { - self.set('busy', false); - self.set('repos', lists); - self.getRepoLists(); - }, function (error) { //jshint ignore: line - self.set('busy', false); - self.set('authenticated', false); - self.showNotification("Unable to fetch repositories"); - console.log(error); - }); - */ this.getOrgReposLists(); if (is.undefined(this.get('initDateTimePicker'))) { @@ -151,134 +136,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, }, - /* - getRepoLists() { - this.set('busy', true); - - let repos = this.get('repos'); - let thisRepo = this.get('config.repo'); - - if (is.null(repos) || is.undefined(repos) || repos.length === 0) { - this.set('noRepos', true); - return; - } - - this.set('noRepos', false); - - if (is.null(thisRepo) || is.undefined(thisRepo) || thisRepo.owner !== this.get('config.owner').name) { - if (repos.length) { - thisRepo = repos[0]; - this.set('config.repo', thisRepo); - } - } else { - this.set('config.repo', repos.findBy('id', thisRepo.id)); - } - - this.set('repo', thisRepo); - - this.getReportLists(); - }, - - getReportLists() { - let reports = []; - reports[0] = { - id: "commitsData", // used as method for fetching Go data - name: "Commits on a branch" - }; - reports[1] = { - id: "issuesData", // used as method for fetching Go data - name: "Issues" - }; - - this.set("reports", reports); - - let thisReport = this.get('config.report'); - - if (is.null(thisReport) || is.undefined(thisReport)) { - thisReport = reports[0]; - this.set('config.report', thisReport); - } else { - this.set('config.report', reports.findBy('id', thisReport.id)); - } - - this.set('report', thisReport); - - this.renderSwitch(thisReport); - - }, - - renderSwitch(thisReport) { - - if (is.undefined(this.get('initDateTimePicker'))) { - $.datetimepicker.setLocale('en'); - $('#branch-since').datetimepicker(); - this.set('initDateTimePicker', "Done"); - } - - let bl = this.get('config.branchLines'); - if (is.undefined(bl) || bl === "" || bl <= 0) { - this.set('config.branchLines', "30"); - } - - this.set('showCommits', false); - this.set('showLabels', false); - switch (thisReport.id) { - case 'commitsData': - this.set('showCommits', true); - this.getBranchLists(); - break; - case 'issuesData': - this.set('showLabels', true); - this.getLabelLists(); - break; - } - }, - - getBranchLists() { - this.set('busy', true); - - let self = this; - let page = this.get('page'); - - this.get('sectionService').fetch(page, "branches", self.get('config')) - .then(function (lists) { - let savedLists = self.get('config.lists'); - if (savedLists === null) { - savedLists = []; - } - - if (lists.length > 0) { - let noIncluded = true; - - lists.forEach(function (list) { - let included = false; - var saved; - if (is.not.undefined(savedLists)) { - saved = savedLists.findBy("id", list.id); - } - if (is.not.undefined(saved)) { - included = saved.included; - noIncluded = false; - } - list.included = included; - }); - - if (noIncluded) { - lists[0].included = true; // make the first entry the default - } - } - - self.set('config.lists', lists); - self.set('busy', false); - }, function (error) { //jshint ignore: line - self.set('busy', false); - self.set('authenticated', false); - self.showNotification("Unable to fetch repository branches"); - console.log(error); - }); - }, - */ - getOrgReposLists() { this.set('busy', true); @@ -323,72 +180,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, }); }, - /* - getLabelLists() { - this.set('busy', true); - - let self = this; - let page = this.get('page'); - - let states = []; - states[0] = { - id: "open", - name: "Open Issues" - }; - states[1] = { - id: "closed", - name: "Closed Issues" - }; - states[2] = { - id: "all", - name: "All Issues" - }; - - this.set("states", states); - - let thisState = this.get('config.state'); - - if (is.null(thisState) || is.undefined(thisState)) { - thisState = states[0]; - this.set('config.state', thisState); - } else { - this.set('config.state', states.findBy('id', thisState.id)); - } - - this.set('state', thisState); - - this.get('sectionService').fetch(page, "labels", self.get('config')) - .then(function (lists) { - let savedLists = self.get('config.lists'); - if (savedLists === null) { - savedLists = []; - } - - if (lists.length > 0) { - lists.forEach(function (list) { - var saved; - if (is.not.undefined(savedLists)) { - saved = savedLists.findBy("id", list.id); - } - let included = false; - if (is.not.undefined(saved)) { - included = saved.included; - } - list.included = included; - }); - } - - self.set('config.lists', lists); - self.set('busy', false); - }, function (error) { //jshint ignore: line - self.set('busy', false); - self.set('authenticated', false); - self.showNotification("Unable to fetch repository labels"); - console.log(error); - }); - }, - */ - actions: { isDirty() { return this.get('isDirty'); @@ -398,27 +189,11 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, let lists = this.get('config.lists'); let list = lists.findBy('id', id); - // restore the list of branches to the default state - //lists.forEach(function (lst) { - // Ember.set(lst, 'included', false); - //}); - if (list !== null) { Ember.set(list, 'included', !list.included); } }, - /* - onLabelCheckbox(id) { - let lists = this.get('config.lists'); - let list = lists.findBy('id', id); - - if (list !== null) { - Ember.set(list, 'included', !list.included); - } - }, - */ - authStage2() { let self = this; self.set('config.userId', self.get("session.session.authenticated.user.id")); @@ -459,21 +234,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, this.getOwnerLists(); }, - /* - onRepoChange(thisRepo) { - this.set('isDirty', true); - this.set('config.repo', thisRepo); - this.set('config.lists', []); - this.getRepoLists(); - }, - - onReportChange(thisReport) { - this.set('isDirty', true); - this.set('config.report', thisReport); - this.getReportLists(); - }, - */ - onStateChange(thisState) { this.set('config.state', thisState); }, diff --git a/core/section/github/commits.go b/core/section/github/commits.go index cca18362..20a5aacf 100644 --- a/core/section/github/commits.go +++ b/core/section/github/commits.go @@ -150,7 +150,6 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit, var bd time.Time if v.Commit != nil { if v.Commit.Committer.Date != nil { - // d = fmt.Sprintf("%v", *v.Commit.Committer.Date) d = v.Commit.Committer.Date.Format(commitTimeFormat) bd = *v.Commit.Committer.Date } @@ -159,7 +158,7 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit, } } - // TODO(elliott5) remove this comment + // TODO(elliott5) remove this comment when it is clear we should not use committer /* var a, l string if v.Committer != nil { diff --git a/core/section/github/github.go b/core/section/github/github.go index a394cf34..6c249c65 100644 --- a/core/section/github/github.go +++ b/core/section/github/github.go @@ -132,7 +132,6 @@ func (p *Provider) Command(ctx *provider.Context, w http.ResponseWriter, r *http if listFailed(method, config, client, w) { - // TODO refactor - currently treats all remaining commands as triggering a report-set gr := githubRender{} for _, rep := range reports { log.IfErr(rep.refresh(&gr, &config, client)) diff --git a/core/section/github/issuenum.go b/core/section/github/issuenum.go deleted file mode 100644 index b1c02713..00000000 --- a/core/section/github/issuenum.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2016 Documize Inc. . All rights reserved. -// -// This software (Documize Community Edition) is licensed under -// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html -// -// You can operate outside the AGPL restrictions by purchasing -// Documize Enterprise Edition and obtaining a commercial license -// by contacting . -// -// https://documize.com - -package github - -// THIS TO KEEP UNUSED CODE FOR THIS POSSIBLE FUTURE FUNCITON - -/* -type githubIssueActivity struct { - Date string `json:"date"` - Event string `json:"event"` - Message template.HTML `json:"message"` - URL template.URL `json:"url"` - Name string `json:"name"` - Avatar string `json:"avatar"` -} -*/ - -// FROM renderTemplates - -/* "issuenum_data": ` -
-

- Activity for issue #{{.IssueNum}} in repository {{.Repo.Name}}. - Up to {{ .Limit }} items are shown{{ .DateMessage }}. -

-
-
    - {{range $data := .IssueNumActivity}} -
  • -
    - @{{$data.Name}} -
    -
    - {{$data.Name}} {{$data.Event}} {{$data.Date}} -
    -
    -
    - {{$data.Message}} -
    -
    -
    -
  • - {{end}} -
-
-
- `,*/ - -// FROM Command() -/*case "issuenum_data": - -render, err := t.getIssueNum(client, config) -if err != nil { - log.Error("github getIssueNum:", err) - provider.WriteError(w, "github", err) - return -} - -provider.WriteJSON(w, render)*/ - -// FROM Refresh() -/*case "issuenum_data": -refreshed, err := t.getIssueNum(t.githubClient(c), c) -if err != nil { - log.Error("unable to get github issue number activity", err) - return data -} -j, err := json.Marshal(refreshed) -if err != nil { - log.Error("unable to marshall github issue number activity", err) - return data -} -return string(j)*/ - -// FROM Render() -/* case "issuenum_data": -payload.IssueNum = c.IssueNum -raw := []githubIssueActivity{} - -if len(data) > 0 { - err = json.Unmarshal([]byte(data), &raw) - if err != nil { - log.Error("unable to unmarshall github issue activity data", err) - return "Documize internal github json umarshall issue activity data error: " + err.Error() - } -} - -opt := &gogithub.MarkdownOptions{Mode: "gfm", Context: c.Owner + "/" + c.Repo} -client := p.githubClient(c) -for k, v := range raw { - if v.Event == "commented" { - output, _, err := client.Markdown(string(v.Message), opt) - if err != nil { - log.Error("convert commented text to markdown", err) - } else { - raw[k].Message = template.HTML(output) - } - } -} -payload.IssueNumActivity = raw */ - -/* -func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]githubIssueActivity, error) { - - ret := []githubIssueActivity{} - - issue, _, err := client.Issues.Get(config.Owner, config.Repo, config.IssueNum) - - if err == nil { - n := "" - a := "" - p := issue.User - if p != nil { - if p.Login != nil { - n = *p.Login - } - if p.AvatarURL != nil { - a = *p.AvatarURL - } - } - ret = append(ret, githubIssueActivity{ - Name: n, - Event: "created", - Message: template.HTML(*issue.Title), - Date: "on " + issue.UpdatedAt.Format("January 2 2006, 15:04"), - Avatar: a, - URL: template.URL(*issue.HTMLURL), - }) - ret = append(ret, githubIssueActivity{ - Name: n, - Event: "described", - Message: template.HTML(*issue.Body), - Date: "on " + issue.UpdatedAt.Format("January 2 2006, 15:04"), - Avatar: a, - URL: template.URL(*issue.HTMLURL), - }) - ret = append(ret, githubIssueActivity{ - Name: "", - Event: "Note", - Message: template.HTML("the issue timeline below is in reverse order"), - Date: "", - Avatar: githubGravatar, - URL: template.URL(*issue.HTMLURL), - }) - } else { - return ret, err - } - - opts := &gogithub.ListOptions{PerPage: config.BranchLines} - - guff, _, err := client.Issues.ListIssueTimeline(config.Owner, config.Repo, config.IssueNum, opts) - - if err != nil { - return ret, err - } - - for _, v := range guff { - if config.SincePtr == nil || v.CreatedAt.After(*config.SincePtr) { - var n, a, m, u string - - p := v.Actor - if p != nil { - if p.Name != nil { - n = *p.Name - } - if p.AvatarURL != nil { - a = *p.AvatarURL - } - } - - u = fmt.Sprintf("https://github.com/%s/%s/issues/%d#event-%d", - config.Owner, config.Repo, config.IssueNum, *v.ID) - - switch *v.Event { - case "commented": - ic, _, err := client.Issues.GetComment(config.Owner, config.Repo, *v.ID) - if err != nil { - log.ErrorString("github error fetching issue event comment: " + err.Error()) - } else { - m = *ic.Body - u = *ic.HTMLURL - p := ic.User - if p != nil { - if p.Login != nil { - n = *p.Login - } - if p.AvatarURL != nil { - a = *p.AvatarURL - } - } - } - } - - ret = append(ret, githubIssueActivity{ - Name: n, - Event: *v.Event, - Message: template.HTML(m), - Date: "on " + v.CreatedAt.Format("January 2 2006, 15:04"), - Avatar: a, - URL: template.URL(u), - }) - } - } - - return ret, nil - -} -*/ diff --git a/core/section/github/issues.go b/core/section/github/issues.go index a81f14be..8da0fbaf 100644 --- a/core/section/github/issues.go +++ b/core/section/github/issues.go @@ -33,6 +33,7 @@ type githubIssue struct { LabelNames []string `json:"labelNames"` IsOpen bool `json:"isopen"` Repo string `json:"repo"` + Private bool `json:"private"` Milestone string `json:"milestone"` } @@ -121,14 +122,6 @@ func getIssues(client *gogithub.Client, config *githubConfig) ([]githubIssue, er opts.Since = *config.SincePtr } - /* TODO refactor to select certain lables - for _, lab := range config.Lists { - if lab.Included { - opts.Labels = append(opts.Labels, lab.Name) - } - } - */ - guff, _, err := client.Issues.ListByRepo(orb.Owner, orb.Repo, opts) if err != nil { @@ -164,6 +157,7 @@ func getIssues(client *gogithub.Client, config *githubConfig) ([]githubIssue, er ID: *v.Number, IsOpen: *v.State == "open", Repo: repoName(rName), + Private: orb.Private, Milestone: ms, }) } diff --git a/core/section/github/lists.go b/core/section/github/lists.go index 87804370..5720cde0 100644 --- a/core/section/github/lists.go +++ b/core/section/github/lists.go @@ -52,80 +52,6 @@ func listFailed(method string, config githubConfig, client *gogithub.Client, w h provider.WriteJSON(w, owners) - /* - case "repos": - - var render []githubRepo - if config.Owner != "" { - - me, _, err := client.Users.Get("") - if err != nil { - log.Error("github get user details:", err) - provider.WriteError(w, "github", err) - return - } - - var repos []*gogithub.Repository - if config.Owner == *me.Login { - repos, _, err = client.Repositories.List(config.Owner, nil) - } else { - opt := &gogithub.RepositoryListByOrgOptions{ - ListOptions: gogithub.ListOptions{PerPage: 100}, - } - repos, _, err = client.Repositories.ListByOrg(config.Owner, opt) - } - if err != nil { - log.Error("github get user/org repositories:", err) - provider.WriteError(w, "github", err) - return - } - for _, vr := range repos { - private := "" - if *vr.Private { - private = " (private)" - } - render = append(render, - githubRepo{ - Name: config.Owner + "/" + *vr.Name + private, - ID: fmt.Sprintf("%s:%s", config.Owner, *vr.Name), - Owner: config.Owner, - Repo: *vr.Name, - Private: *vr.Private, - URL: *vr.HTMLURL, - }) - } - } - render = sortRepos(render) - - provider.WriteJSON(w, render) - - case "branches": - - if config.Owner == "" || config.Repo == "" { - provider.WriteJSON(w, []githubBranch{}) // we have nothing to return - return - } - branches, _, err := client.Repositories.ListBranches(config.Owner, config.Repo, - &gogithub.ListOptions{PerPage: 100}) - if err != nil { - log.Error("github get branch details:", err) - provider.WriteError(w, "github", err) - return - } - render := make([]githubBranch, len(branches)) - for kc, vb := range branches { - render[kc] = githubBranch{ - Owner: config.Owner, - Repo: config.Repo, - Name: *vb.Name, - ID: fmt.Sprintf("%s:%s:%s", config.Owner, config.Repo, *vb.Name), - Included: false, - URL: "https://github.com/" + config.Owner + "/" + config.Repo + "/tree/" + *vb.Name, - } - } - - provider.WriteJSON(w, render) - */ case "orgrepos": @@ -170,32 +96,6 @@ func listFailed(method string, config githubConfig, client *gogithub.Client, w h provider.WriteJSON(w, render) - /* - case "labels": - - if config.Owner == "" || config.Repo == "" { - provider.WriteJSON(w, []githubBranch{}) // we have nothing to return - return - } - labels, _, err := client.Issues.ListLabels(config.Owner, config.Repo, - &gogithub.ListOptions{PerPage: 100}) - if err != nil { - log.Error("github get labels:", err) - provider.WriteError(w, "github", err) - return - } - render := make([]githubBranch, len(labels)) - for kc, vb := range labels { - render[kc] = githubBranch{ - Name: *vb.Name, - ID: fmt.Sprintf("%s:%s:%s", config.Owner, config.Repo, *vb.Name), - Included: false, - Color: *vb.Color, - } - } - - provider.WriteJSON(w, render) - */ default: return true // failed to get a list diff --git a/core/section/github/milestones.go b/core/section/github/milestones.go index f41f6be0..de6314ad 100644 --- a/core/section/github/milestones.go +++ b/core/section/github/milestones.go @@ -22,6 +22,7 @@ import ( type githubMilestone struct { Repo string `json:"repo"` + Private bool `json:"private"` Name string `json:"name"` URL string `json:"url"` IsOpen bool `json:"isopen"` @@ -124,6 +125,7 @@ func getMilestones(client *gogithub.Client, config *githubConfig) ([]githubMiles ret = append(ret, githubMilestone{ Repo: repoName(rName), + Private: orb.Private, Name: *v.Title, URL: *v.HTMLURL, IsOpen: *v.State == "open", @@ -190,7 +192,7 @@ func renderMilestones(payload *githubRender, c *githubConfig) error { } if issuesClosed+issuesOpen > 0 { payload.Milestones = append(payload.Milestones, githubMilestone{ - Repo: rName, Name: noMilestone, IsOpen: true, + Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true, OpenIssues: issuesOpen, ClosedIssues: issuesClosed, }) } diff --git a/core/section/github/model.go b/core/section/github/model.go index 632ae6df..2f236ebe 100644 --- a/core/section/github/model.go +++ b/core/section/github/model.go @@ -45,7 +45,6 @@ type githubRender struct { ClosedPRs int `json:"closedPRs"` AuthorStats []githubAuthorStats `json:"authorStats"` HasAuthorStats bool `json:"hasAuthorStats"` - //PullRequests []githubPullRequest `json:"pullRequests"` } type report struct { @@ -72,7 +71,7 @@ type githubRepo struct { Included bool `json:"included"` Owner string `json:"owner"` Repo string `json:"repo"` - Private bool `json:"private"` // TODO review field use + Private bool `json:"private"` URL string `json:"url"` } @@ -154,31 +153,7 @@ func (c *githubConfig) Clean() { } c.Since = (*c.SincePtr).Format(issuesTimeFormat) - // TEST DATA INSERTION DEBUG ONLY! - /* - debugList := map[string][]string{ - "community": []string{"master"}, - "enterprise": []string{"master"}, - "test-data": []string{"master"}, - } - c.Lists = make([]githubBranch, 0, len(debugList)*3) - for repo, branches := range debugList { - render := make([]githubBranch, len(branches)) - for kc, vb := range branches { - render[kc] = githubBranch{ - Owner: "documize", - Repo: repo, - Name: vb, - ID: fmt.Sprintf("%s:%s:%s", "documize", repo, vb), - Included: true, - URL: "https://github.com/" + "documize" + "/" + repo + "/tree/" + vb, - } - } - c.Lists = append(c.Lists, render...) - } - c.Owner = "documize" - */ - c.ReportOrder = []string{tagSummaryData, tagMilestonesData, tagIssuesData /*, tagPullRequestData*/, tagCommitsData} + c.ReportOrder = []string{tagSummaryData, tagMilestonesData, tagIssuesData, tagCommitsData} c.BranchLines = 100 // overide js default of 30 with maximum allowable in one call sort.Stable(branchesToSort(c.Lists)) // get the configured branches in a sensible order for printing diff --git a/core/section/github/pullrequests.go b/core/section/github/pullrequests.go deleted file mode 100644 index fece4bae..00000000 --- a/core/section/github/pullrequests.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2016 Documize Inc. . All rights reserved. -// -// This software (Documize Community Edition) is licensed under -// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html -// -// You can operate outside the AGPL restrictions by purchasing -// Documize Enterprise Edition and obtaining a commercial license -// by contacting . -// -// https://documize.com - -package github - -/* Remove for now - -import ( - "sort" - "time" - - "github.com/documize/community/core/log" - - gogithub "github.com/google/go-github/github" -) - -type githubPullRequest struct { - Repo string `json:"repo"` - Name string `json:"name"` - URL string `json:"url"` - IsOpen bool `json:"isopen"` - UpdatedAt string `json:"updatedAt"` -} - -// sort pull requests in order that that should be presented - by date updated, closed first. - -type prToSort []githubPullRequest - -func (s prToSort) Len() int { return len(s) } -func (s prToSort) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s prToSort) Less(i, j int) bool { - if !s[i].IsOpen && s[j].IsOpen { - return true - } - if s[i].IsOpen && !s[j].IsOpen { - return false - } - // TODO this seems a very slow approach - iDate, iErr := time.Parse(milestonesTimeFormat, s[i].UpdatedAt) - log.IfErr(iErr) - jDate, jErr := time.Parse(milestonesTimeFormat, s[j].UpdatedAt) - log.IfErr(jErr) - return iDate.Before(jDate) - -} - -const ( - tagPullRequestData = "pullRequestData" - - rawPRsvg = `` - openPRsvg = ` - - - ` + rawPRsvg + ` - - - ` - closedPRsvg = ` - - - ` + rawPRsvg + ` - - - ` -) - -func init() { - reports[tagPullRequestData] = report{refreshPullReqs, renderPullReqs, ` -
-

Pull Requests: {{.ClosedPRs}} closed, {{.OpenPRs}} open

- -
-`} -} - -func getPullReqs(client *gogithub.Client, config *githubConfig) ([]githubPullRequest, error) { - - ret := []githubPullRequest{} - - hadRepo := make(map[string]bool) - - for _, orb := range config.Lists { - if orb.Included { - rName := orb.Owner + "/" + orb.Repo - - if !hadRepo[rName] { - - for _, state := range []string{"open", "closed"} { - - opts := &gogithub.PullRequestListOptions{ - Sort: "updated", - State: state, - ListOptions: gogithub.ListOptions{PerPage: config.BranchLines}} - - guff, _, err := client.PullRequests.List(orb.Owner, orb.Repo, opts) - - if err != nil { - return ret, err - } - - for _, v := range guff { - include := true - if state == "closed" { - if config.SincePtr != nil { - if (*config.SincePtr).After(*v.ClosedAt) { - include = false - } - } - } - if include { - up := "" - if v.UpdatedAt != nil { - up = (*v.UpdatedAt).Format(milestonesTimeFormat) - } - - ret = append(ret, githubPullRequest{ - Repo: rName, - Name: *v.Title, - URL: *v.HTMLURL, - IsOpen: *v.State == "open", - UpdatedAt: up, - }) - } - } - - } - - } - hadRepo[rName] = true - } - - } - - sort.Stable(prToSort(ret)) - - return ret, nil - -} - -func refreshPullReqs(gr *githubRender, config *githubConfig, client *gogithub.Client) (err error) { - - gr.PullRequests, err = getPullReqs(client, config) - if err != nil { - log.Error("unable to get github Pull Requests", err) - return err - } - - gr.OpenPRs = 0 - gr.ClosedPRs = 0 - for _, v := range gr.PullRequests { - if v.IsOpen { - gr.OpenPRs++ - } else { - gr.ClosedPRs++ - } - } - - return nil -} - -func renderPullReqs(payload *githubRender, c *githubConfig) error { - return nil -} - -*/