Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 21:26:10 +01:00

Fix JS error when changing PR's target branch (#23862) (#23864)

Backport #23862 by @wxiaoguang

Caught by @justusbunsi 

An old bug from #6488

In `pullrequest_targetbranch_change`, the `data` might be empty, because
`UpdatePullRequestTarget` may respond `http.StatusNoContent`.

And the old code's `$branchTarget.text(data.base_branch);` doesn't make
sense, because in the end, the page will be always reloaded.

So, just remove the `$branchTarget.text(data.base_branch);`, everything
should be fine.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot 2023-04-01 21:15:46 -04:00 committed by GitHub
parent 16bfe983c2
commit 8abfbe2165
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -647,8 +647,6 @@ export function initRepoIssueTitleEdit() {
$.post(update_url, {
_csrf: csrfToken,
target_branch: targetBranch
}).done((data) => {
$branchTarget.text(data.base_branch);
}).always(() => {
window.location.reload();
});