Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,9 @@ func NewIssue(ctx *context.Context) {
ctx.Data["Project"] = project
}

if len(ctx.Req.URL.Query().Get("project")) > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this is unnecessary? The POST requests will also request the current URL. So that the query strings are still there.

Copy link
Contributor

@wxiaoguang wxiaoguang Oct 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue edit form's action is filled by {{.Link}}, without query string. So this parameter is necessary.

ctx.Data["redirect_after_creation"] = "project"
}
}

RetrieveRepoMetas(ctx, ctx.Repo.Repository, false)
Expand Down Expand Up @@ -990,7 +993,11 @@ func NewIssuePost(ctx *context.Context) {
}

log.Trace("Issue created: %d/%d", repo.ID, issue.ID)
ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + fmt.Sprint(issue.Index))
if ctx.FormString("redirect_after_creation") == "project" {
ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + fmt.Sprint(form.ProjectID))
} else {
ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + fmt.Sprint(issue.Index))
}
}

// commentTag returns the CommentTag for a comment in/with the given repo, poster and issue
Expand Down
1 change: 1 addition & 0 deletions templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,6 @@
{{end}}
</div>
</div>
<input type="hidden" name="redirect_after_creation" value="{{.redirect_after_creation}}">
</div>
</form>