mirror of https://github.com/gogs/gogs.git
Minor code fix for PR #3560
parent
98076ee72d
commit
d528704503
|
@ -3,7 +3,7 @@ Gogs - Go Git Service [
|

|
||||||
|
|
||||||
##### Current tip version: 0.9.113 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
|
##### Current tip version: 0.9.114 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
|
||||||
|
|
||||||
| Web | UI | Preview |
|
| Web | UI | Preview |
|
||||||
|:-------------:|:-------:|:-------:|
|
|:-------------:|:-------:|:-------:|
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.9.113.1223"
|
const APP_VER = "0.9.114.1227"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -1004,17 +1004,17 @@ func GetIssueUserPairsByRepoIds(rids []int64, isClosed bool, page int) ([]*Issue
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueUserPairsByMode returns issue-user pairs by given repository and user.
|
// GetIssueUserPairsByMode returns issue-user pairs by given repository and user.
|
||||||
func GetIssueUserPairsByMode(uid, rid int64, isClosed bool, page, filterMode int) ([]*IssueUser, error) {
|
func GetIssueUserPairsByMode(userID, repoID int64, filterMode FilterMode, isClosed bool, page int) ([]*IssueUser, error) {
|
||||||
ius := make([]*IssueUser, 0, 10)
|
ius := make([]*IssueUser, 0, 10)
|
||||||
sess := x.Limit(20, (page-1)*20).Where("uid=?", uid).And("is_closed=?", isClosed)
|
sess := x.Limit(20, (page-1)*20).Where("uid=?", userID).And("is_closed=?", isClosed)
|
||||||
if rid > 0 {
|
if repoID > 0 {
|
||||||
sess.And("repo_id=?", rid)
|
sess.And("repo_id=?", repoID)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch filterMode {
|
switch filterMode {
|
||||||
case FM_ASSIGN:
|
case FILTER_MODE_ASSIGN:
|
||||||
sess.And("is_assigned=?", true)
|
sess.And("is_assigned=?", true)
|
||||||
case FM_CREATE:
|
case FILTER_MODE_CREATE:
|
||||||
sess.And("is_poster=?", true)
|
sess.And("is_poster=?", true)
|
||||||
default:
|
default:
|
||||||
return ius, nil
|
return ius, nil
|
||||||
|
@ -1069,18 +1069,19 @@ func updateIssueMentions(e Engine, issueID int64, mentions []string) error {
|
||||||
// IssueStats represents issue statistic information.
|
// IssueStats represents issue statistic information.
|
||||||
type IssueStats struct {
|
type IssueStats struct {
|
||||||
OpenCount, ClosedCount int64
|
OpenCount, ClosedCount int64
|
||||||
YourRepositoriesCount int64
|
YourReposCount int64
|
||||||
AssignCount int64
|
AssignCount int64
|
||||||
CreateCount int64
|
CreateCount int64
|
||||||
MentionCount int64
|
MentionCount int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter modes.
|
type FilterMode string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FM_YOUR_REPOSITORIES = iota
|
FILTER_MODE_YOUR_REPOS FilterMode = "your_repositories"
|
||||||
FM_ASSIGN
|
FILTER_MODE_ASSIGN FilterMode = "assigned"
|
||||||
FM_CREATE
|
FILTER_MODE_CREATE FilterMode = "created_by"
|
||||||
FM_MENTION
|
FILTER_MODE_MENTION FilterMode = "mentioned"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseCountResult(results []map[string][]byte) int64 {
|
func parseCountResult(results []map[string][]byte) int64 {
|
||||||
|
@ -1099,7 +1100,7 @@ type IssueStatsOptions struct {
|
||||||
Labels string
|
Labels string
|
||||||
MilestoneID int64
|
MilestoneID int64
|
||||||
AssigneeID int64
|
AssigneeID int64
|
||||||
FilterMode int
|
FilterMode FilterMode
|
||||||
IsPull bool
|
IsPull bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1129,7 +1130,7 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch opts.FilterMode {
|
switch opts.FilterMode {
|
||||||
case FM_YOUR_REPOSITORIES, FM_ASSIGN:
|
case FILTER_MODE_YOUR_REPOS, FILTER_MODE_ASSIGN:
|
||||||
stats.OpenCount, _ = countSession(opts).
|
stats.OpenCount, _ = countSession(opts).
|
||||||
And("is_closed = ?", false).
|
And("is_closed = ?", false).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
|
@ -1137,7 +1138,7 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
|
||||||
stats.ClosedCount, _ = countSession(opts).
|
stats.ClosedCount, _ = countSession(opts).
|
||||||
And("is_closed = ?", true).
|
And("is_closed = ?", true).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
case FM_CREATE:
|
case FILTER_MODE_CREATE:
|
||||||
stats.OpenCount, _ = countSession(opts).
|
stats.OpenCount, _ = countSession(opts).
|
||||||
And("poster_id = ?", opts.UserID).
|
And("poster_id = ?", opts.UserID).
|
||||||
And("is_closed = ?", false).
|
And("is_closed = ?", false).
|
||||||
|
@ -1147,7 +1148,7 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
|
||||||
And("poster_id = ?", opts.UserID).
|
And("poster_id = ?", opts.UserID).
|
||||||
And("is_closed = ?", true).
|
And("is_closed = ?", true).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
case FM_MENTION:
|
case FILTER_MODE_MENTION:
|
||||||
stats.OpenCount, _ = countSession(opts).
|
stats.OpenCount, _ = countSession(opts).
|
||||||
Join("INNER", "issue_user", "issue.id = issue_user.issue_id").
|
Join("INNER", "issue_user", "issue.id = issue_user.issue_id").
|
||||||
And("issue_user.uid = ?", opts.UserID).
|
And("issue_user.uid = ?", opts.UserID).
|
||||||
|
@ -1166,7 +1167,7 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserIssueStats returns issue statistic information for dashboard by given conditions.
|
// GetUserIssueStats returns issue statistic information for dashboard by given conditions.
|
||||||
func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPull bool) *IssueStats {
|
func GetUserIssueStats(repoID, userID int64, repoIDs []int64, filterMode FilterMode, isPull bool) *IssueStats {
|
||||||
stats := &IssueStats{}
|
stats := &IssueStats{}
|
||||||
|
|
||||||
countSession := func(isClosed, isPull bool, repoID int64, repoIDs []int64) *xorm.Session {
|
countSession := func(isClosed, isPull bool, repoID int64, repoIDs []int64) *xorm.Session {
|
||||||
|
@ -1182,35 +1183,35 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
|
||||||
}
|
}
|
||||||
|
|
||||||
stats.AssignCount, _ = countSession(false, isPull, repoID, nil).
|
stats.AssignCount, _ = countSession(false, isPull, repoID, nil).
|
||||||
And("assignee_id = ?", uid).
|
And("assignee_id = ?", userID).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
|
|
||||||
stats.CreateCount, _ = countSession(false, isPull, repoID, nil).
|
stats.CreateCount, _ = countSession(false, isPull, repoID, nil).
|
||||||
And("poster_id = ?", uid).
|
And("poster_id = ?", userID).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
|
|
||||||
stats.YourRepositoriesCount, _ = countSession(false, isPull, repoID, repoIDs).
|
stats.YourReposCount, _ = countSession(false, isPull, repoID, repoIDs).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
|
|
||||||
switch filterMode {
|
switch filterMode {
|
||||||
case FM_YOUR_REPOSITORIES:
|
case FILTER_MODE_YOUR_REPOS:
|
||||||
stats.OpenCount, _ = countSession(false, isPull, repoID, repoIDs).
|
stats.OpenCount, _ = countSession(false, isPull, repoID, repoIDs).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
stats.ClosedCount, _ = countSession(true, isPull, repoID, repoIDs).
|
stats.ClosedCount, _ = countSession(true, isPull, repoID, repoIDs).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
case FM_ASSIGN:
|
case FILTER_MODE_ASSIGN:
|
||||||
stats.OpenCount, _ = countSession(false, isPull, repoID, nil).
|
stats.OpenCount, _ = countSession(false, isPull, repoID, nil).
|
||||||
And("assignee_id = ?", uid).
|
And("assignee_id = ?", userID).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
stats.ClosedCount, _ = countSession(true, isPull, repoID, nil).
|
stats.ClosedCount, _ = countSession(true, isPull, repoID, nil).
|
||||||
And("assignee_id = ?", uid).
|
And("assignee_id = ?", userID).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
case FM_CREATE:
|
case FILTER_MODE_CREATE:
|
||||||
stats.OpenCount, _ = countSession(false, isPull, repoID, nil).
|
stats.OpenCount, _ = countSession(false, isPull, repoID, nil).
|
||||||
And("poster_id = ?", uid).
|
And("poster_id = ?", userID).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
stats.ClosedCount, _ = countSession(true, isPull, repoID, nil).
|
stats.ClosedCount, _ = countSession(true, isPull, repoID, nil).
|
||||||
And("poster_id = ?", uid).
|
And("poster_id = ?", userID).
|
||||||
Count(new(Issue))
|
Count(new(Issue))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1219,7 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRepoIssueStats returns number of open and closed repository issues by given filter mode.
|
// GetRepoIssueStats returns number of open and closed repository issues by given filter mode.
|
||||||
func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64) {
|
func GetRepoIssueStats(repoID, userID int64, filterMode FilterMode, isPull bool) (numOpen int64, numClosed int64) {
|
||||||
countSession := func(isClosed, isPull bool, repoID int64) *xorm.Session {
|
countSession := func(isClosed, isPull bool, repoID int64) *xorm.Session {
|
||||||
sess := x.Where("issue.repo_id = ?", isClosed).
|
sess := x.Where("issue.repo_id = ?", isClosed).
|
||||||
And("is_pull = ?", isPull).
|
And("is_pull = ?", isPull).
|
||||||
|
@ -1231,12 +1232,12 @@ func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen
|
||||||
closedCountSession := countSession(true, isPull, repoID)
|
closedCountSession := countSession(true, isPull, repoID)
|
||||||
|
|
||||||
switch filterMode {
|
switch filterMode {
|
||||||
case FM_ASSIGN:
|
case FILTER_MODE_ASSIGN:
|
||||||
openCountSession.And("assignee_id = ?", uid)
|
openCountSession.And("assignee_id = ?", userID)
|
||||||
closedCountSession.And("assignee_id = ?", uid)
|
closedCountSession.And("assignee_id = ?", userID)
|
||||||
case FM_CREATE:
|
case FILTER_MODE_CREATE:
|
||||||
openCountSession.And("poster_id = ?", uid)
|
openCountSession.And("poster_id = ?", userID)
|
||||||
closedCountSession.And("poster_id = ?", uid)
|
closedCountSession.And("poster_id = ?", userID)
|
||||||
}
|
}
|
||||||
|
|
||||||
openResult, _ := openCountSession.Count(new(Issue))
|
openResult, _ := openCountSession.Count(new(Issue))
|
||||||
|
|
|
@ -376,8 +376,8 @@ func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IssueStats returns number of open and closed repository issues by given filter mode.
|
// IssueStats returns number of open and closed repository issues by given filter mode.
|
||||||
func (repo *Repository) IssueStats(uid int64, filterMode int, isPull bool) (int64, int64) {
|
func (repo *Repository) IssueStats(userID int64, filterMode FilterMode, isPull bool) (int64, int64) {
|
||||||
return GetRepoIssueStats(repo.ID, uid, filterMode, isPull)
|
return GetRepoIssueStats(repo.ID, userID, filterMode, isPull)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) GetMirror() (err error) {
|
func (repo *Repository) GetMirror() (err error) {
|
||||||
|
|
|
@ -121,16 +121,16 @@ func Issues(ctx *context.Context) {
|
||||||
assigneeID = ctx.QueryInt64("assignee")
|
assigneeID = ctx.QueryInt64("assignee")
|
||||||
posterID int64
|
posterID int64
|
||||||
)
|
)
|
||||||
filterMode := models.FM_YOUR_REPOSITORIES
|
filterMode := models.FILTER_MODE_YOUR_REPOS
|
||||||
switch viewType {
|
switch viewType {
|
||||||
case "assigned":
|
case "assigned":
|
||||||
filterMode = models.FM_ASSIGN
|
filterMode = models.FILTER_MODE_ASSIGN
|
||||||
assigneeID = ctx.User.ID
|
assigneeID = ctx.User.ID
|
||||||
case "created_by":
|
case "created_by":
|
||||||
filterMode = models.FM_CREATE
|
filterMode = models.FILTER_MODE_CREATE
|
||||||
posterID = ctx.User.ID
|
posterID = ctx.User.ID
|
||||||
case "mentioned":
|
case "mentioned":
|
||||||
filterMode = models.FM_MENTION
|
filterMode = models.FILTER_MODE_MENTION
|
||||||
}
|
}
|
||||||
|
|
||||||
var uid int64 = -1
|
var uid int64 = -1
|
||||||
|
@ -174,7 +174,7 @@ func Issues(ctx *context.Context) {
|
||||||
MilestoneID: milestoneID,
|
MilestoneID: milestoneID,
|
||||||
Page: pager.Current(),
|
Page: pager.Current(),
|
||||||
IsClosed: isShowClosed,
|
IsClosed: isShowClosed,
|
||||||
IsMention: filterMode == models.FM_MENTION,
|
IsMention: filterMode == models.FILTER_MODE_MENTION,
|
||||||
IsPull: isPullList,
|
IsPull: isPullList,
|
||||||
Labels: selectLabels,
|
Labels: selectLabels,
|
||||||
SortType: sortType,
|
SortType: sortType,
|
||||||
|
|
|
@ -168,29 +168,23 @@ func Issues(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Organization does not have view type and filter mode.
|
|
||||||
var (
|
var (
|
||||||
viewType string
|
|
||||||
sortType = ctx.Query("sort")
|
sortType = ctx.Query("sort")
|
||||||
filterMode = models.FM_YOUR_REPOSITORIES
|
filterMode = models.FILTER_MODE_YOUR_REPOS
|
||||||
)
|
)
|
||||||
if ctxUser.IsOrganization() {
|
|
||||||
viewType = "your_repositories"
|
|
||||||
} else {
|
|
||||||
viewType = ctx.Query("type")
|
|
||||||
types := []string{"your_repositories", "assigned", "created_by"}
|
|
||||||
if !com.IsSliceContainsStr(types, viewType) {
|
|
||||||
viewType = "your_repositories"
|
|
||||||
}
|
|
||||||
|
|
||||||
switch viewType {
|
// Note: Organization does not have view type and filter mode.
|
||||||
case "your_repositories":
|
if !ctxUser.IsOrganization() {
|
||||||
filterMode = models.FM_YOUR_REPOSITORIES
|
viewType := ctx.Query("type")
|
||||||
case "assigned":
|
types := []string{
|
||||||
filterMode = models.FM_ASSIGN
|
string(models.FILTER_MODE_YOUR_REPOS),
|
||||||
case "created_by":
|
string(models.FILTER_MODE_ASSIGN),
|
||||||
filterMode = models.FM_CREATE
|
string(models.FILTER_MODE_CREATE),
|
||||||
}
|
}
|
||||||
|
if !com.IsSliceContainsStr(types, viewType) {
|
||||||
|
viewType = string(models.FILTER_MODE_YOUR_REPOS)
|
||||||
|
}
|
||||||
|
filterMode = models.FilterMode(viewType)
|
||||||
}
|
}
|
||||||
|
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
|
@ -202,86 +196,83 @@ func Issues(ctx *context.Context) {
|
||||||
isShowClosed := ctx.Query("state") == "closed"
|
isShowClosed := ctx.Query("state") == "closed"
|
||||||
|
|
||||||
// Get repositories.
|
// Get repositories.
|
||||||
var err error
|
var (
|
||||||
var repos []*models.Repository
|
err error
|
||||||
userRepoIDs := make([]int64, 0, len(repos))
|
repos []*models.Repository
|
||||||
if ctxUser.IsOrganization() {
|
userRepoIDs []int64
|
||||||
repos, _, err = ctxUser.GetUserRepositories(ctx.User.ID, 1, ctxUser.NumRepos)
|
showRepos = make([]*models.Repository, 0, 10)
|
||||||
if err != nil {
|
)
|
||||||
ctx.Handle(500, "GetRepositories", err)
|
if filterMode == models.FILTER_MODE_YOUR_REPOS {
|
||||||
return
|
if ctxUser.IsOrganization() {
|
||||||
|
repos, _, err = ctxUser.GetUserRepositories(ctx.User.ID, 1, ctxUser.NumRepos)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetRepositories", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := ctxUser.GetRepositories(1, ctx.User.NumRepos); err != nil {
|
||||||
|
ctx.Handle(500, "GetRepositories", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
repos = ctxUser.Repos
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if err := ctxUser.GetRepositories(1, ctx.User.NumRepos); err != nil {
|
userRepoIDs = make([]int64, 0, len(repos))
|
||||||
ctx.Handle(500, "GetRepositories", err)
|
for _, repo := range repos {
|
||||||
return
|
if isPullList {
|
||||||
|
if isShowClosed && repo.NumClosedPulls == 0 ||
|
||||||
|
!isShowClosed && repo.NumOpenPulls == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !repo.EnableIssues || repo.EnableExternalTracker ||
|
||||||
|
isShowClosed && repo.NumClosedIssues == 0 ||
|
||||||
|
!isShowClosed && repo.NumOpenIssues == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
userRepoIDs = append(userRepoIDs, repo.ID)
|
||||||
|
showRepos = append(showRepos, repo)
|
||||||
}
|
}
|
||||||
repos = ctxUser.Repos
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range repos {
|
issueOptions := &models.IssuesOptions{
|
||||||
if (isPullList && repo.NumPulls == 0) ||
|
RepoID: repoID,
|
||||||
(!isPullList &&
|
Page: page,
|
||||||
(!repo.EnableIssues || repo.EnableExternalTracker || repo.NumIssues == 0)) {
|
IsClosed: isShowClosed,
|
||||||
continue
|
IsPull: isPullList,
|
||||||
}
|
SortType: sortType,
|
||||||
|
|
||||||
userRepoIDs = append(userRepoIDs, repo.ID)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var issues []*models.Issue
|
|
||||||
switch filterMode {
|
switch filterMode {
|
||||||
case models.FM_YOUR_REPOSITORIES:
|
case models.FILTER_MODE_YOUR_REPOS:
|
||||||
// Get all issues from repositories from this user.
|
// Get all issues from repositories from this user.
|
||||||
issues, err = models.Issues(&models.IssuesOptions{
|
issueOptions.RepoIDs = userRepoIDs
|
||||||
RepoIDs: userRepoIDs,
|
|
||||||
RepoID: repoID,
|
|
||||||
Page: page,
|
|
||||||
IsClosed: isShowClosed,
|
|
||||||
IsPull: isPullList,
|
|
||||||
SortType: sortType,
|
|
||||||
})
|
|
||||||
|
|
||||||
case models.FM_ASSIGN:
|
case models.FILTER_MODE_ASSIGN:
|
||||||
// Get all issues assigned to this user.
|
// Get all issues assigned to this user.
|
||||||
issues, err = models.Issues(&models.IssuesOptions{
|
issueOptions.AssigneeID = ctxUser.ID
|
||||||
RepoID: repoID,
|
|
||||||
AssigneeID: ctxUser.ID,
|
|
||||||
Page: page,
|
|
||||||
IsClosed: isShowClosed,
|
|
||||||
IsPull: isPullList,
|
|
||||||
SortType: sortType,
|
|
||||||
})
|
|
||||||
|
|
||||||
case models.FM_CREATE:
|
case models.FILTER_MODE_CREATE:
|
||||||
// Get all issues created by this user.
|
// Get all issues created by this user.
|
||||||
issues, err = models.Issues(&models.IssuesOptions{
|
issueOptions.PosterID = ctxUser.ID
|
||||||
RepoID: repoID,
|
|
||||||
PosterID: ctxUser.ID,
|
|
||||||
Page: page,
|
|
||||||
IsClosed: isShowClosed,
|
|
||||||
IsPull: isPullList,
|
|
||||||
SortType: sortType,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issues, err := models.Issues(issueOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "Issues", err)
|
ctx.Handle(500, "Issues", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showRepos := make([]*models.Repository, 0, len(issues))
|
|
||||||
showReposSet := make(map[int64]bool)
|
|
||||||
|
|
||||||
if repoID > 0 {
|
if repoID > 0 {
|
||||||
repo, err := models.GetRepositoryByID(repoID)
|
repo, err := models.GetRepositoryByID(repoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetRepositoryByID", fmt.Errorf("[#%d]%v", repoID, err))
|
ctx.Handle(500, "GetRepositoryByID", fmt.Errorf("[#%d] %v", repoID, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = repo.GetOwner(); err != nil {
|
if err = repo.GetOwner(); err != nil {
|
||||||
ctx.Handle(500, "GetOwner", fmt.Errorf("[#%d]%v", repoID, err))
|
ctx.Handle(500, "GetOwner", fmt.Errorf("[#%d] %v", repoID, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,35 +281,13 @@ func Issues(ctx *context.Context) {
|
||||||
ctx.Handle(404, "Issues", fmt.Errorf("#%d", repoID))
|
ctx.Handle(404, "Issues", fmt.Errorf("#%d", repoID))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showReposSet[repoID] = true
|
|
||||||
showRepos = append(showRepos, repo)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, issue := range issues {
|
for _, issue := range issues {
|
||||||
// Get Repository data.
|
|
||||||
issue.Repo, err = models.GetRepositoryByID(issue.RepoID)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "GetRepositoryByID", fmt.Errorf("[#%d]%v", issue.RepoID, err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Owner data.
|
|
||||||
if err = issue.Repo.GetOwner(); err != nil {
|
if err = issue.Repo.GetOwner(); err != nil {
|
||||||
ctx.Handle(500, "GetOwner", fmt.Errorf("[#%d]%v", issue.RepoID, err))
|
ctx.Handle(500, "GetOwner", fmt.Errorf("[#%d] %v", issue.RepoID, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append repo to list of shown repos
|
|
||||||
if filterMode == models.FM_YOUR_REPOSITORIES {
|
|
||||||
// Use a map to make sure we don't add the same Repository twice.
|
|
||||||
_, ok := showReposSet[issue.RepoID]
|
|
||||||
if !ok {
|
|
||||||
showReposSet[issue.RepoID] = true
|
|
||||||
// Append to list of shown Repositories.
|
|
||||||
showRepos = append(showRepos, issue.Repo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
issueStats := models.GetUserIssueStats(repoID, ctxUser.ID, userRepoIDs, filterMode, isPullList)
|
issueStats := models.GetUserIssueStats(repoID, ctxUser.ID, userRepoIDs, filterMode, isPullList)
|
||||||
|
@ -334,7 +303,7 @@ func Issues(ctx *context.Context) {
|
||||||
ctx.Data["Repos"] = showRepos
|
ctx.Data["Repos"] = showRepos
|
||||||
ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5)
|
ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5)
|
||||||
ctx.Data["IssueStats"] = issueStats
|
ctx.Data["IssueStats"] = issueStats
|
||||||
ctx.Data["ViewType"] = viewType
|
ctx.Data["ViewType"] = string(filterMode)
|
||||||
ctx.Data["SortType"] = sortType
|
ctx.Data["SortType"] = sortType
|
||||||
ctx.Data["RepoID"] = repoID
|
ctx.Data["RepoID"] = repoID
|
||||||
ctx.Data["IsShowClosed"] = isShowClosed
|
ctx.Data["IsShowClosed"] = isShowClosed
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.9.113.1223
|
0.9.114.1227
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="ui secondary vertical filter menu">
|
<div class="ui secondary vertical filter menu">
|
||||||
<a class="{{if eq .ViewType "your_repositories"}}ui basic blue button{{end}} item" href="{{.Link}}?type=your_repositories&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
|
<a class="{{if eq .ViewType "your_repositories"}}ui basic blue button{{end}} item" href="{{.Link}}?type=your_repositories&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
|
||||||
{{.i18n.Tr "home.issues.in_your_repos"}}
|
{{.i18n.Tr "home.issues.in_your_repos"}}
|
||||||
<strong class="ui right">{{.IssueStats.YourRepositoriesCount}}</strong>
|
<strong class="ui right">{{.IssueStats.YourReposCount}}</strong>
|
||||||
</a>
|
</a>
|
||||||
{{if not .ContextUser.IsOrganization}}
|
{{if not .ContextUser.IsOrganization}}
|
||||||
<a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
|
<a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
|
||||||
|
@ -83,17 +83,17 @@
|
||||||
{{if gt .TotalPages 1}}
|
{{if gt .TotalPages 1}}
|
||||||
<div class="center page buttons">
|
<div class="center page buttons">
|
||||||
<div class="ui borderless pagination menu">
|
<div class="ui borderless pagination menu">
|
||||||
<a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&page={{.Previous}}"{{end}}>
|
<a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&page={{.Previous}}"{{end}}>
|
||||||
<i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
|
<i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
|
||||||
</a>
|
</a>
|
||||||
{{range .Pages}}
|
{{range .Pages}}
|
||||||
{{if eq .Num -1}}
|
{{if eq .Num -1}}
|
||||||
<a class="disabled item">...</a>
|
<a class="disabled item">...</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&page={{.Num}}"{{end}}>{{.Num}}</a>
|
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&page={{.Num}}"{{end}}>{{.Num}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
<a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.Link}}?type={{$.ViewType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&page={{.Next}}"{{end}}>
|
<a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&page={{.Next}}"{{end}}>
|
||||||
{{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
|
{{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue