diff --git a/appview/db/pulls.go b/appview/db/pulls.go index 64defaa1..10f7e47a 100644 --- a/appview/db/pulls.go +++ b/appview/db/pulls.go @@ -10,9 +10,9 @@ import ( type PullState int const ( - PullOpen PullState = iota + PullClosed PullState = iota + PullOpen PullMerged - PullClosed ) func (p PullState) String() string { @@ -87,11 +87,12 @@ func NewPull(tx *sql.Tx, pull *Pull) error { } pull.PullId = nextId + pull.State = PullOpen _, err = tx.Exec(` - insert into pulls (repo_at, owner_did, pull_id, title, target_branch, body, patch, rkey) - values (?, ?, ?, ?, ?, ?, ?, ?) - `, pull.RepoAt, pull.OwnerDid, pull.PullId, pull.Title, pull.TargetBranch, pull.Body, pull.Patch, pull.Rkey) + insert into pulls (repo_at, owner_did, pull_id, title, target_branch, body, patch, rkey, state) + values (?, ?, ?, ?, ?, ?, ?, ?, ?) + `, pull.RepoAt, pull.OwnerDid, pull.PullId, pull.Title, pull.TargetBranch, pull.Body, pull.Patch, pull.Rkey, pull.State) if err != nil { return err } @@ -134,7 +135,7 @@ func GetPulls(e Execer, repoAt syntax.ATURI, state PullState) ([]Pull, error) { pull_at, body, patch, - rkey + rkey from pulls where diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 980a93c2..7e1de38d 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -271,8 +271,13 @@ func (r RepoInfo) GetTabs() [][]string { func (r RepoInfo) TabMetadata() map[string]any { meta := make(map[string]any) - meta["issues"] = r.Stats.IssueCount.Open - meta["pulls"] = r.Stats.PullCount.Open + if r.Stats.PullCount.Open > 0 { + meta["pulls"] = r.Stats.PullCount.Open + } + + if r.Stats.IssueCount.Open > 0 { + meta["issues"] = r.Stats.IssueCount.Open + } // more stuff? diff --git a/appview/pages/templates/layouts/repobase.html b/appview/pages/templates/layouts/repobase.html index 3412b321..64369f51 100644 --- a/appview/pages/templates/layouts/repobase.html +++ b/appview/pages/templates/layouts/repobase.html @@ -38,7 +38,7 @@ > {{ $key }} {{ if not (isNil $meta) }} - {{ $meta }} + {{ $meta }} {{ end }} diff --git a/appview/pages/templates/repo/pulls/new.html b/appview/pages/templates/repo/pulls/new.html index 0be063f2..b7f3ed13 100644 --- a/appview/pages/templates/repo/pulls/new.html +++ b/appview/pages/templates/repo/pulls/new.html @@ -8,15 +8,15 @@ >
- + - +

The branch you want to make your change against.