mirror of
https://github.com/documize/community.git
synced 2025-07-22 14:49:42 +02:00
fix Github section milestone URL and blank commit messages
This commit is contained in:
parent
bb429bc687
commit
545b1cba71
3 changed files with 23 additions and 25 deletions
|
@ -29,14 +29,13 @@ type githubCommit struct {
|
|||
Repo string `json:"repo"`
|
||||
ShowRepo bool `json:"showRepo"`
|
||||
Branch string `json:"branch"`
|
||||
ShowBranch bool `json:"ShowBranch"`
|
||||
ShowBranch bool `json:"showBranch"`
|
||||
Date string `json:"date"`
|
||||
BinDate time.Time `json:"-"` // only used for sorting
|
||||
ShowDate bool `json:"ShowDate"`
|
||||
ShowDate bool `json:"showDate"`
|
||||
Login string `json:"login"`
|
||||
Name string `json:"name"`
|
||||
Avatar string `json:"avatar"`
|
||||
ShowUser bool `json:"ShowUser"`
|
||||
Message string `json:"message"`
|
||||
URL template.URL `json:"url"`
|
||||
}
|
||||
|
@ -224,7 +223,6 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit,
|
|||
overall[k].ShowRepo = true
|
||||
overall[k].ShowBranch = true
|
||||
overall[k].ShowDate = true
|
||||
overall[k].ShowUser = true
|
||||
if k > 0 {
|
||||
if overall[k].Repo == overall[k-1].Repo {
|
||||
overall[k].ShowRepo = false
|
||||
|
@ -232,7 +230,6 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit,
|
|||
overall[k].ShowBranch = false
|
||||
if overall[k].Date == overall[k-1].Date {
|
||||
overall[k].ShowDate = false
|
||||
overall[k].ShowUser = overall[k].Name != overall[k-1].Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,9 +73,7 @@ const commitsTemplate = `
|
|||
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
|
||||
</td>
|
||||
<td>
|
||||
{{if $commit.ShowUser}}
|
||||
<div class="contributor-name"><a href="{{$commit.URL}}">{{$commit.Message}}</a></div>
|
||||
{{end}}
|
||||
<div class="contributor-name"><a href="{{$commit.URL}}">{{$commit.Message}}</a></div>
|
||||
<div class="contributor-meta">
|
||||
{{$commit.Name}}
|
||||
{{if $commit.ShowDate}} · {{$commit.Date}} {{end}}
|
||||
|
|
|
@ -13,6 +13,7 @@ package github
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"sort"
|
||||
|
||||
"github.com/documize/community/core/log"
|
||||
|
@ -21,18 +22,18 @@ import (
|
|||
)
|
||||
|
||||
type githubMilestone struct {
|
||||
Repo string `json:"repo"`
|
||||
Private bool `json:"private"`
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
IsOpen bool `json:"isopen"`
|
||||
OpenIssues int `json:"openIssues"`
|
||||
ClosedIssues int `json:"closedIssues"`
|
||||
CompleteMsg string `json:"completeMsg"`
|
||||
DueDate string `json:"dueDate"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
Progress uint `json:"progress"`
|
||||
IsMilestone bool `json:"isMilestone"`
|
||||
Repo string `json:"repo"`
|
||||
Private bool `json:"private"`
|
||||
Name string `json:"name"`
|
||||
URL template.URL `json:"url"`
|
||||
IsOpen bool `json:"isopen"`
|
||||
OpenIssues int `json:"openIssues"`
|
||||
ClosedIssues int `json:"closedIssues"`
|
||||
CompleteMsg string `json:"completeMsg"`
|
||||
DueDate string `json:"dueDate"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
Progress uint `json:"progress"`
|
||||
IsMilestone bool `json:"isMilestone"`
|
||||
}
|
||||
|
||||
// sort milestones in order that that should be presented.
|
||||
|
@ -124,10 +125,12 @@ func getMilestones(client *gogithub.Client, config *githubConfig) ([]githubMiles
|
|||
progress := float64(*v.ClosedIssues*100) / float64(*v.OpenIssues+*v.ClosedIssues)
|
||||
|
||||
ret = append(ret, githubMilestone{
|
||||
Repo: repoName(rName),
|
||||
Private: orb.Private,
|
||||
Name: *v.Title,
|
||||
URL: *v.HTMLURL,
|
||||
Repo: repoName(rName),
|
||||
Private: orb.Private,
|
||||
Name: *v.Title,
|
||||
URL: template.URL(fmt.Sprintf(
|
||||
"https://github.com/%s/%s/milestone/%d",
|
||||
orb.Owner, orb.Repo, *v.Number)), // *v.HTMLURL does not give the correct value
|
||||
IsOpen: *v.State == "open",
|
||||
OpenIssues: *v.OpenIssues,
|
||||
ClosedIssues: *v.ClosedIssues,
|
||||
|
@ -196,7 +199,7 @@ func renderMilestones(payload *githubRender, c *githubConfig) error {
|
|||
if issuesClosed+issuesOpen > 0 {
|
||||
payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
||||
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL,
|
||||
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: template.URL(orb.URL),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue