Display warning when user try to rename default branch (#24512)
Follow #24380 It's better to warn users when they try to rename the default branch.  --------- Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
0ca1958e1a
commit
0c657112a3
3 changed files with 11 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
import {toggleElem} from '../utils/dom.js';
|
||||
|
||||
export function initRepoBranchButton() {
|
||||
initRepoCreateBranchButton();
|
||||
|
@ -31,6 +32,10 @@ function initRepoRenameBranchButton() {
|
|||
const oldBranchName = $(this).attr('data-old-branch-name');
|
||||
$modal.find('input[name=from]').val(oldBranchName);
|
||||
|
||||
// display the warning that the branch which is chosen is the default branch
|
||||
const $warn = $modal.find('.default-branch-warning');
|
||||
toggleElem($warn, $(this).attr('data-is-default-branch') === 'true');
|
||||
|
||||
const $text = $modal.find('[data-rename-branch-to]');
|
||||
$text.text($text.attr('data-rename-branch-to').replace('%s', oldBranchName));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue