|
|
|
@ -110,15 +110,15 @@ func MustAllowPulls(ctx *context.Context) {
|
|
|
|
|
|
|
|
|
|
func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption util.OptionalBool) {
|
|
|
|
|
var err error
|
|
|
|
|
viewType := ctx.Query("type")
|
|
|
|
|
sortType := ctx.Query("sort")
|
|
|
|
|
viewType := ctx.Form("type")
|
|
|
|
|
sortType := ctx.Form("sort")
|
|
|
|
|
types := []string{"all", "your_repositories", "assigned", "created_by", "mentioned", "review_requested"}
|
|
|
|
|
if !util.IsStringInSlice(viewType, types, true) {
|
|
|
|
|
viewType = "all"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
assigneeID = ctx.QueryInt64("assignee")
|
|
|
|
|
assigneeID = ctx.FormInt64("assignee")
|
|
|
|
|
posterID int64
|
|
|
|
|
mentionedID int64
|
|
|
|
|
reviewRequestedID int64
|
|
|
|
@ -140,7 +140,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|
|
|
|
|
|
|
|
|
repo := ctx.Repo.Repository
|
|
|
|
|
var labelIDs []int64
|
|
|
|
|
selectLabels := ctx.Query("labels")
|
|
|
|
|
selectLabels := ctx.Form("labels")
|
|
|
|
|
if len(selectLabels) > 0 && selectLabels != "0" {
|
|
|
|
|
labelIDs, err = base.StringsToInt64s(strings.Split(selectLabels, ","))
|
|
|
|
|
if err != nil {
|
|
|
|
@ -149,7 +149,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keyword := strings.Trim(ctx.Query("q"), " ")
|
|
|
|
|
keyword := strings.Trim(ctx.Form("q"), " ")
|
|
|
|
|
if bytes.Contains([]byte(keyword), []byte{0x00}) {
|
|
|
|
|
keyword = ""
|
|
|
|
|
}
|
|
|
|
@ -187,13 +187,13 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isShowClosed := ctx.Query("state") == "closed"
|
|
|
|
|
isShowClosed := ctx.Form("state") == "closed"
|
|
|
|
|
// if open issues are zero and close don't, use closed as default
|
|
|
|
|
if len(ctx.Query("state")) == 0 && issueStats.OpenCount == 0 && issueStats.ClosedCount != 0 {
|
|
|
|
|
if len(ctx.Form("state")) == 0 && issueStats.OpenCount == 0 && issueStats.ClosedCount != 0 {
|
|
|
|
|
isShowClosed = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
page := ctx.QueryInt("page")
|
|
|
|
|
page := ctx.FormInt("page")
|
|
|
|
|
if page <= 1 {
|
|
|
|
|
page = 1
|
|
|
|
|
}
|
|
|
|
@ -285,7 +285,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if repo.Owner.IsOrganization() {
|
|
|
|
|
orgLabels, err := models.GetLabelsByOrgID(repo.Owner.ID, ctx.Query("sort"), models.ListOptions{})
|
|
|
|
|
orgLabels, err := models.GetLabelsByOrgID(repo.Owner.ID, ctx.Form("sort"), models.ListOptions{})
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.ServerError("GetLabelsByOrgID", err)
|
|
|
|
|
return
|
|
|
|
@ -301,7 +301,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|
|
|
|
ctx.Data["Labels"] = labels
|
|
|
|
|
ctx.Data["NumLabels"] = len(labels)
|
|
|
|
|
|
|
|
|
|
if ctx.QueryInt64("assignee") == 0 {
|
|
|
|
|
if ctx.FormInt64("assignee") == 0 {
|
|
|
|
|
assigneeID = 0 // Reset ID to prevent unexpected selection of assignee.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -371,7 +371,7 @@ func Issues(ctx *context.Context) {
|
|
|
|
|
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
issues(ctx, ctx.QueryInt64("milestone"), ctx.QueryInt64("project"), util.OptionalBoolOf(isPullList))
|
|
|
|
|
issues(ctx, ctx.FormInt64("milestone"), ctx.FormInt64("project"), util.OptionalBoolOf(isPullList))
|
|
|
|
|
if ctx.Written() {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -380,7 +380,7 @@ func Issues(ctx *context.Context) {
|
|
|
|
|
// Get milestones
|
|
|
|
|
ctx.Data["Milestones"], err = models.GetMilestones(models.GetMilestonesOption{
|
|
|
|
|
RepoID: ctx.Repo.Repository.ID,
|
|
|
|
|
State: api.StateType(ctx.Query("state")),
|
|
|
|
|
State: api.StateType(ctx.Form("state")),
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.ServerError("GetAllRepoMilestones", err)
|
|
|
|
@ -655,7 +655,7 @@ func RetrieveRepoMetas(ctx *context.Context, repo *models.Repository, isPull boo
|
|
|
|
|
}
|
|
|
|
|
ctx.Data["Labels"] = labels
|
|
|
|
|
if repo.Owner.IsOrganization() {
|
|
|
|
|
orgLabels, err := models.GetLabelsByOrgID(repo.Owner.ID, ctx.Query("sort"), models.ListOptions{})
|
|
|
|
|
orgLabels, err := models.GetLabelsByOrgID(repo.Owner.ID, ctx.Form("sort"), models.ListOptions{})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
@ -719,9 +719,9 @@ func getFileContentFromDefaultBranch(ctx *context.Context, filename string) (str
|
|
|
|
|
|
|
|
|
|
func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs []string, possibleFiles []string) {
|
|
|
|
|
templateCandidates := make([]string, 0, len(possibleFiles))
|
|
|
|
|
if ctx.Query("template") != "" {
|
|
|
|
|
if ctx.Form("template") != "" {
|
|
|
|
|
for _, dirName := range possibleDirs {
|
|
|
|
|
templateCandidates = append(templateCandidates, path.Join(dirName, ctx.Query("template")))
|
|
|
|
|
templateCandidates = append(templateCandidates, path.Join(dirName, ctx.Form("template")))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
templateCandidates = append(templateCandidates, possibleFiles...) // Append files to the end because they should be fallback
|
|
|
|
@ -741,7 +741,7 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [
|
|
|
|
|
if repoLabels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, "", models.ListOptions{}); err == nil {
|
|
|
|
|
ctx.Data["Labels"] = repoLabels
|
|
|
|
|
if ctx.Repo.Owner.IsOrganization() {
|
|
|
|
|
if orgLabels, err := models.GetLabelsByOrgID(ctx.Repo.Owner.ID, ctx.Query("sort"), models.ListOptions{}); err == nil {
|
|
|
|
|
if orgLabels, err := models.GetLabelsByOrgID(ctx.Repo.Owner.ID, ctx.Form("sort"), models.ListOptions{}); err == nil {
|
|
|
|
|
ctx.Data["OrgLabels"] = orgLabels
|
|
|
|
|
repoLabels = append(repoLabels, orgLabels...)
|
|
|
|
|
}
|
|
|
|
@ -773,16 +773,16 @@ func NewIssue(ctx *context.Context) {
|
|
|
|
|
ctx.Data["RequireSimpleMDE"] = true
|
|
|
|
|
ctx.Data["RequireTribute"] = true
|
|
|
|
|
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
|
|
|
|
|
title := ctx.Query("title")
|
|
|
|
|
title := ctx.Form("title")
|
|
|
|
|
ctx.Data["TitleQuery"] = title
|
|
|
|
|
body := ctx.Query("body")
|
|
|
|
|
body := ctx.Form("body")
|
|
|
|
|
ctx.Data["BodyQuery"] = body
|
|
|
|
|
|
|
|
|
|
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(models.UnitTypeProjects)
|
|
|
|
|
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
|
|
|
|
|
upload.AddUploadContext(ctx, "comment")
|
|
|
|
|
|
|
|
|
|
milestoneID := ctx.QueryInt64("milestone")
|
|
|
|
|
milestoneID := ctx.FormInt64("milestone")
|
|
|
|
|
if milestoneID > 0 {
|
|
|
|
|
milestone, err := models.GetMilestoneByID(milestoneID)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -793,7 +793,7 @@ func NewIssue(ctx *context.Context) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
projectID := ctx.QueryInt64("project")
|
|
|
|
|
projectID := ctx.FormInt64("project")
|
|
|
|
|
if projectID > 0 {
|
|
|
|
|
project, err := models.GetProjectByID(projectID)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -822,7 +822,7 @@ func NewIssue(ctx *context.Context) {
|
|
|
|
|
func NewIssueChooseTemplate(ctx *context.Context) {
|
|
|
|
|
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
|
|
|
|
|
ctx.Data["PageIsIssueList"] = true
|
|
|
|
|
ctx.Data["milestone"] = ctx.QueryInt64("milestone")
|
|
|
|
|
ctx.Data["milestone"] = ctx.FormInt64("milestone")
|
|
|
|
|
|
|
|
|
|
issueTemplates := ctx.IssueTemplatesFromDefaultBranch()
|
|
|
|
|
ctx.Data["NewIssueChooseTemplate"] = len(issueTemplates) > 0
|
|
|
|
@ -1174,7 +1174,7 @@ func ViewIssue(ctx *context.Context) {
|
|
|
|
|
ctx.Data["Labels"] = labels
|
|
|
|
|
|
|
|
|
|
if repo.Owner.IsOrganization() {
|
|
|
|
|
orgLabels, err := models.GetLabelsByOrgID(repo.Owner.ID, ctx.Query("sort"), models.ListOptions{})
|
|
|
|
|
orgLabels, err := models.GetLabelsByOrgID(repo.Owner.ID, ctx.Form("sort"), models.ListOptions{})
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.ServerError("GetLabelsByOrgID", err)
|
|
|
|
|
return
|
|
|
|
@ -1624,7 +1624,7 @@ func checkIssueRights(ctx *context.Context, issue *models.Issue) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getActionIssues(ctx *context.Context) []*models.Issue {
|
|
|
|
|
commaSeparatedIssueIDs := ctx.Query("issue_ids")
|
|
|
|
|
commaSeparatedIssueIDs := ctx.Form("issue_ids")
|
|
|
|
|
if len(commaSeparatedIssueIDs) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
@ -1670,7 +1670,7 @@ func UpdateIssueTitle(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
title := ctx.QueryTrim("title")
|
|
|
|
|
title := ctx.FormTrim("title")
|
|
|
|
|
if len(title) == 0 {
|
|
|
|
|
ctx.Error(http.StatusNoContent)
|
|
|
|
|
return
|
|
|
|
@ -1698,7 +1698,7 @@ func UpdateIssueRef(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref := ctx.QueryTrim("ref")
|
|
|
|
|
ref := ctx.FormTrim("ref")
|
|
|
|
|
|
|
|
|
|
if err := issue_service.ChangeIssueRef(issue, ctx.User, ref); err != nil {
|
|
|
|
|
ctx.ServerError("ChangeRef", err)
|
|
|
|
@ -1722,20 +1722,20 @@ func UpdateIssueContent(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
content := ctx.Query("content")
|
|
|
|
|
content := ctx.Form("content")
|
|
|
|
|
if err := issue_service.ChangeContent(issue, ctx.User, content); err != nil {
|
|
|
|
|
ctx.ServerError("ChangeContent", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
files := ctx.QueryStrings("files[]")
|
|
|
|
|
files := ctx.FormStrings("files[]")
|
|
|
|
|
if err := updateAttachments(issue, files); err != nil {
|
|
|
|
|
ctx.ServerError("UpdateAttachments", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
content, err := markdown.RenderString(&markup.RenderContext{
|
|
|
|
|
URLPrefix: ctx.Query("context"),
|
|
|
|
|
URLPrefix: ctx.Form("context"),
|
|
|
|
|
Metas: ctx.Repo.Repository.ComposeMetas(),
|
|
|
|
|
GitRepo: ctx.Repo.GitRepo,
|
|
|
|
|
}, issue.Content)
|
|
|
|
@ -1757,7 +1757,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
milestoneID := ctx.QueryInt64("id")
|
|
|
|
|
milestoneID := ctx.FormInt64("id")
|
|
|
|
|
for _, issue := range issues {
|
|
|
|
|
oldMilestoneID := issue.MilestoneID
|
|
|
|
|
if oldMilestoneID == milestoneID {
|
|
|
|
@ -1782,8 +1782,8 @@ func UpdateIssueAssignee(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assigneeID := ctx.QueryInt64("id")
|
|
|
|
|
action := ctx.Query("action")
|
|
|
|
|
assigneeID := ctx.FormInt64("id")
|
|
|
|
|
action := ctx.Form("action")
|
|
|
|
|
|
|
|
|
|
for _, issue := range issues {
|
|
|
|
|
switch action {
|
|
|
|
@ -1828,8 +1828,8 @@ func UpdatePullReviewRequest(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reviewID := ctx.QueryInt64("id")
|
|
|
|
|
action := ctx.Query("action")
|
|
|
|
|
reviewID := ctx.FormInt64("id")
|
|
|
|
|
action := ctx.Form("action")
|
|
|
|
|
|
|
|
|
|
// TODO: Not support 'clear' now
|
|
|
|
|
if action != "attach" && action != "detach" {
|
|
|
|
@ -1954,7 +1954,7 @@ func UpdateIssueStatus(ctx *context.Context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var isClosed bool
|
|
|
|
|
switch action := ctx.Query("action"); action {
|
|
|
|
|
switch action := ctx.Form("action"); action {
|
|
|
|
|
case "open":
|
|
|
|
|
isClosed = false
|
|
|
|
|
case "close":
|
|
|
|
@ -2145,7 +2145,7 @@ func UpdateCommentContent(ctx *context.Context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldContent := comment.Content
|
|
|
|
|
comment.Content = ctx.Query("content")
|
|
|
|
|
comment.Content = ctx.Form("content")
|
|
|
|
|
if len(comment.Content) == 0 {
|
|
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{
|
|
|
|
|
"content": "",
|
|
|
|
@ -2157,14 +2157,14 @@ func UpdateCommentContent(ctx *context.Context) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
files := ctx.QueryStrings("files[]")
|
|
|
|
|
files := ctx.FormStrings("files[]")
|
|
|
|
|
if err := updateAttachments(comment, files); err != nil {
|
|
|
|
|
ctx.ServerError("UpdateAttachments", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
content, err := markdown.RenderString(&markup.RenderContext{
|
|
|
|
|
URLPrefix: ctx.Query("context"),
|
|
|
|
|
URLPrefix: ctx.Form("context"),
|
|
|
|
|
Metas: ctx.Repo.Repository.ComposeMetas(),
|
|
|
|
|
GitRepo: ctx.Repo.GitRepo,
|
|
|
|
|
}, comment.Content)
|
|
|
|
|