Skip to content

Commit

Permalink
Fix JS error when changing PR's target branch (go-gitea#23862)
Browse files Browse the repository at this point in the history
Caught by @justusbunsi 

An old bug from go-gitea#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.
  • Loading branch information
wxiaoguang authored and Linux User committed Apr 1, 2023
1 parent 16bfe98 commit ffc585e
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 ffc585e

Please sign in to comment.