mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix assigned issues dashboard (#920)
* Fix assigned/created issues in dashboard. (#3560) * Fix assigned/created issues in dashboard. * Use GetUserIssueStats for getting all Dashboard stats. * Use gofmt to format the file properly. * Replace &Issue{} with new(Issue). * Check if user has access to given repository. * Remove unnecessary filtering of issues. * Return 404 error if invalid repository is given. * Use correct number of issues in paginater. * fix issues on dashboard
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -108,37 +107,17 @@ func Issues(ctx *context.Context) {
|
||||
|
||||
viewType := ctx.Query("type")
|
||||
sortType := ctx.Query("sort")
|
||||
types := []string{"assigned", "created_by", "mentioned"}
|
||||
types := []string{"all", "assigned", "created_by", "mentioned"}
|
||||
if !com.IsSliceContainsStr(types, viewType) {
|
||||
viewType = "all"
|
||||
}
|
||||
|
||||
// Must sign in to see issues about you.
|
||||
if viewType != "all" && !ctx.IsSigned {
|
||||
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
|
||||
ctx.Redirect(setting.AppSubURL + "/user/login")
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
assigneeID = ctx.QueryInt64("assignee")
|
||||
posterID int64
|
||||
mentionedID int64
|
||||
forceEmpty bool
|
||||
)
|
||||
switch viewType {
|
||||
case "assigned":
|
||||
if assigneeID > 0 && ctx.User.ID != assigneeID {
|
||||
// two different assignees, must be empty
|
||||
forceEmpty = true
|
||||
} else {
|
||||
assigneeID = ctx.User.ID
|
||||
}
|
||||
case "created_by":
|
||||
posterID = ctx.User.ID
|
||||
case "mentioned":
|
||||
mentionedID = ctx.User.ID
|
||||
}
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
selectLabels := ctx.Query("labels")
|
||||
|
Reference in New Issue
Block a user