Skip to content

Commit

Permalink
Fix JS error when changing PR's target branch (#23862) (#23864)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
GiteaBot and wxiaoguang committed Apr 2, 2023
1 parent 16bfe98 commit 8abfbe2
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions web_src/js/features/repo-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 8abfbe2

Please sign in to comment.