mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +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"`
|
Repo string `json:"repo"`
|
||||||
ShowRepo bool `json:"showRepo"`
|
ShowRepo bool `json:"showRepo"`
|
||||||
Branch string `json:"branch"`
|
Branch string `json:"branch"`
|
||||||
ShowBranch bool `json:"ShowBranch"`
|
ShowBranch bool `json:"showBranch"`
|
||||||
Date string `json:"date"`
|
Date string `json:"date"`
|
||||||
BinDate time.Time `json:"-"` // only used for sorting
|
BinDate time.Time `json:"-"` // only used for sorting
|
||||||
ShowDate bool `json:"ShowDate"`
|
ShowDate bool `json:"showDate"`
|
||||||
Login string `json:"login"`
|
Login string `json:"login"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
ShowUser bool `json:"ShowUser"`
|
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
URL template.URL `json:"url"`
|
URL template.URL `json:"url"`
|
||||||
}
|
}
|
||||||
|
@ -224,7 +223,6 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit,
|
||||||
overall[k].ShowRepo = true
|
overall[k].ShowRepo = true
|
||||||
overall[k].ShowBranch = true
|
overall[k].ShowBranch = true
|
||||||
overall[k].ShowDate = true
|
overall[k].ShowDate = true
|
||||||
overall[k].ShowUser = true
|
|
||||||
if k > 0 {
|
if k > 0 {
|
||||||
if overall[k].Repo == overall[k-1].Repo {
|
if overall[k].Repo == overall[k-1].Repo {
|
||||||
overall[k].ShowRepo = false
|
overall[k].ShowRepo = false
|
||||||
|
@ -232,7 +230,6 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubCommit,
|
||||||
overall[k].ShowBranch = false
|
overall[k].ShowBranch = false
|
||||||
if overall[k].Date == overall[k-1].Date {
|
if overall[k].Date == overall[k-1].Date {
|
||||||
overall[k].ShowDate = false
|
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}}" />
|
<img class="github-avatar" alt="@{{$commit.Name}}" src="{{$commit.Avatar}}" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{if $commit.ShowUser}}
|
<div class="contributor-name"><a href="{{$commit.URL}}">{{$commit.Message}}</a></div>
|
||||||
<div class="contributor-name"><a href="{{$commit.URL}}">{{$commit.Message}}</a></div>
|
|
||||||
{{end}}
|
|
||||||
<div class="contributor-meta">
|
<div class="contributor-meta">
|
||||||
{{$commit.Name}}
|
{{$commit.Name}}
|
||||||
{{if $commit.ShowDate}} · {{$commit.Date}} {{end}}
|
{{if $commit.ShowDate}} · {{$commit.Date}} {{end}}
|
||||||
|
|
|
@ -13,6 +13,7 @@ package github
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/documize/community/core/log"
|
"github.com/documize/community/core/log"
|
||||||
|
@ -21,18 +22,18 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type githubMilestone struct {
|
type githubMilestone struct {
|
||||||
Repo string `json:"repo"`
|
Repo string `json:"repo"`
|
||||||
Private bool `json:"private"`
|
Private bool `json:"private"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
URL string `json:"url"`
|
URL template.URL `json:"url"`
|
||||||
IsOpen bool `json:"isopen"`
|
IsOpen bool `json:"isopen"`
|
||||||
OpenIssues int `json:"openIssues"`
|
OpenIssues int `json:"openIssues"`
|
||||||
ClosedIssues int `json:"closedIssues"`
|
ClosedIssues int `json:"closedIssues"`
|
||||||
CompleteMsg string `json:"completeMsg"`
|
CompleteMsg string `json:"completeMsg"`
|
||||||
DueDate string `json:"dueDate"`
|
DueDate string `json:"dueDate"`
|
||||||
UpdatedAt string `json:"updatedAt"`
|
UpdatedAt string `json:"updatedAt"`
|
||||||
Progress uint `json:"progress"`
|
Progress uint `json:"progress"`
|
||||||
IsMilestone bool `json:"isMilestone"`
|
IsMilestone bool `json:"isMilestone"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort milestones in order that that should be presented.
|
// 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)
|
progress := float64(*v.ClosedIssues*100) / float64(*v.OpenIssues+*v.ClosedIssues)
|
||||||
|
|
||||||
ret = append(ret, githubMilestone{
|
ret = append(ret, githubMilestone{
|
||||||
Repo: repoName(rName),
|
Repo: repoName(rName),
|
||||||
Private: orb.Private,
|
Private: orb.Private,
|
||||||
Name: *v.Title,
|
Name: *v.Title,
|
||||||
URL: *v.HTMLURL,
|
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",
|
IsOpen: *v.State == "open",
|
||||||
OpenIssues: *v.OpenIssues,
|
OpenIssues: *v.OpenIssues,
|
||||||
ClosedIssues: *v.ClosedIssues,
|
ClosedIssues: *v.ClosedIssues,
|
||||||
|
@ -196,7 +199,7 @@ func renderMilestones(payload *githubRender, c *githubConfig) error {
|
||||||
if issuesClosed+issuesOpen > 0 {
|
if issuesClosed+issuesOpen > 0 {
|
||||||
payload.Milestones = append(payload.Milestones, githubMilestone{
|
payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||||
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
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