1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 21:59:42 +02:00

remove commented-out code, add Private flags, fix noMilestone names

This commit is contained in:
Elliott Stoneham 2016-08-24 15:25:16 +01:00
parent cf007f8006
commit 288cfdbb59
9 changed files with 8 additions and 792 deletions

View file

@ -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);
},

View file

@ -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 {

View file

@ -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))

View file

@ -1,217 +0,0 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. 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 <sales@documize.com>.
//
// 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": `
<div class="section-github-render">
<p>
Activity for issue #{{.IssueNum}} in repository <a href="{{ .Repo.URL }}/issues">{{.Repo.Name}}.</a>
Up to {{ .Limit }} items are shown{{ .DateMessage }}.
</p>
<div class="github-board">
<ul class="github-list">
{{range $data := .IssueNumActivity}}
<li class="github-commit-item">
<div class="github-avatar">
<img alt="@{{$data.Name}}" src="{{$data.Avatar}}" height="36" width="36">
</div>
<div class="github-commit-meta">
{{$data.Name}} <a class="link" href="{{$data.URL}}">{{$data.Event}}</a> {{$data.Date}}
</div>
<div class="github-commit-body">
<div class="github-commit-title">
{{$data.Message}}
</div>
</div>
<div class="clearfix" />
</li>
{{end}}
</ul>
</div>
</div>
`,*/
// 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
}
*/

View file

@ -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,
})
}

View file

@ -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

View file

@ -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,
})
}

View file

@ -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

View file

@ -1,196 +0,0 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. 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 <sales@documize.com>.
//
// 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 = `<path d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path>`
openPRsvg = `
<span title="Open Pull Request" >
<svg height="16" width="12" version="1.1" viewBox="0 0 12 16">
` + rawPRsvg + `
</svg>
</span>
`
closedPRsvg = `
<span title="Closed Pull Request" >
<svg height="8" width="6" version="1.1" viewBox="0 0 12 16">
` + rawPRsvg + `
</svg>
</span>
`
)
func init() {
reports[tagPullRequestData] = report{refreshPullReqs, renderPullReqs, `
<div class="section-github-render">
<h3>Pull Requests: {{.ClosedPRs}} closed, {{.OpenPRs}} open</h3>
<div class="github-board">
<ul class="github-list">
{{range $data := .PullRequests}}
<li class="github-commit-item">
<a class="link" href="{{$data.URL}}">
<div class="issue-avatar">
{{if $data.IsOpen}}
` + openPRsvg + `
{{else}}
` + closedPRsvg + `
{{end}}
</div>
<div class="github-commit-body">
<div class="github-commit-title"><span class="label-name">{{$data.Repo}} - {{$data.Name}}</span> </div>
<div class="github-commit-meta">
Last updated {{$data.UpdatedAt}}
</div>
</div>
</a>
<div class="clearfix" />
</li>
{{end}}
</ul>
</div>
</div>
`}
}
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
}
*/