mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-25 19:17:19 +08:00
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:
@ -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));
|
||||
});
|
||||
|
Reference in New Issue
Block a user