Merge branch 'main' into lunny/add_comment_move_issue_column

This commit is contained in:
silverwind 2024-03-16 19:51:47 +01:00 committed by GitHub
commit 6dbb557975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 57 additions and 35 deletions

View File

@ -315,7 +315,7 @@ rules:
jquery/no-parent: [0]
jquery/no-parents: [0]
jquery/no-parse-html: [2]
jquery/no-prop: [0]
jquery/no-prop: [2]
jquery/no-proxy: [2]
jquery/no-ready: [2]
jquery/no-serialize: [2]
@ -466,7 +466,7 @@ rules:
no-jquery/no-parse-html: [2]
no-jquery/no-parse-json: [2]
no-jquery/no-parse-xml: [2]
no-jquery/no-prop: [0]
no-jquery/no-prop: [2]
no-jquery/no-proxy: [2]
no-jquery/no-ready-shorthand: [2]
no-jquery/no-ready: [2]

View File

@ -119,7 +119,7 @@ func TestPullView_CodeOwner(t *testing.T) {
user5 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 5})
forkedRepo, err := repo_service.ForkRepository(db.DefaultContext, user2, user5, repo_service.ForkRepoOptions{
BaseRepo: repo,
Name: "test_codeowner_fork",
Name: "test_codeowner",
})
assert.NoError(t, err)
@ -137,9 +137,9 @@ func TestPullView_CodeOwner(t *testing.T) {
assert.NoError(t, err)
session := loginUser(t, "user5")
testPullCreate(t, session, "user5", "test_codeowner_fork", false, forkedRepo.DefaultBranch, "codeowner-basebranch-forked", "Test Pull Request2")
testPullCreate(t, session, "user5", "test_codeowner", true, forkedRepo.DefaultBranch, "codeowner-basebranch-forked", "Test Pull Request2")
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{BaseRepoID: repo.ID, HeadBranch: "codeowner-basebranch-forked"})
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{BaseRepoID: forkedRepo.ID, HeadBranch: "codeowner-basebranch-forked"})
unittest.AssertExistsIf(t, false, &issues_model.Review{IssueID: pr.IssueID, Type: issues_model.ReviewTypeRequest, ReviewerID: 8})
})
})

View File

@ -149,24 +149,32 @@ a {
text-decoration-skip-ink: all;
}
/* muted link = only colored when hovered */
/* silenced link = never colored */
/* a = always colored, underlined on hover */
/* a.muted = colored on hover, underlined on hover */
/* a.suppressed = never colored, underlined on hover */
/* a.silenced = never colored, never underlined */
a.muted,
a.suppressed,
a.silenced,
.muted-links a {
color: inherit;
}
a:hover,
a.suppressed:hover,
a.muted:hover,
a.muted:hover [class*="color-text"],
.muted-links a:hover {
color: var(--color-primary);
}
a.silenced:hover {
a.silenced:hover,
a.suppressed:hover {
color: inherit;
}
a.silenced:hover {
text-decoration: none;
}

View File

@ -457,7 +457,7 @@ export function initRepositoryActionView() {
</div>
</div>
</div>
<div class="job-step-container" ref="steps">
<div class="job-step-container" ref="steps" v-if="currentJob.steps.length">
<div class="job-step-section" v-for="(jobStep, i) in currentJob.steps" :key="i">
<div class="job-step-summary" @click.stop="toggleStepLogs(i)" :class="currentJobStepsStates[i].expanded ? 'selected' : ''">
<!-- If the job is done and the job step log is loaded for the first time, show the loading icon
@ -686,11 +686,15 @@ export function initRepositoryActionView() {
background-color: var(--color-console-bg);
position: sticky;
top: 0;
border-radius: var(--border-radius) var(--border-radius) 0 0;
border-radius: var(--border-radius);
height: 60px;
z-index: 1;
}
.job-info-header:has(+ .job-step-container) {
border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.job-info-header .job-info-header-title {
color: var(--color-console-fg);
font-size: 16px;

View File

@ -49,7 +49,7 @@ export function initAdminCommon() {
}
function onUsePagedSearchChange() {
if ($('#use_paged_search').prop('checked')) {
if (document.getElementById('use_paged_search').checked) {
showElem('.search-page-size');
$('.search-page-size').find('input').attr('required', 'required');
} else {

View File

@ -14,7 +14,7 @@ function updateExclusiveLabelEdit(form) {
if (isExclusiveScopeName($nameInput.val())) {
$exclusiveField.removeClass('muted');
$exclusiveField.removeAttr('aria-disabled');
if ($exclusiveCheckbox.prop('checked') && $exclusiveCheckbox.data('exclusive-warn')) {
if ($exclusiveCheckbox[0].checked && $exclusiveCheckbox.data('exclusive-warn')) {
$exclusiveWarning.removeClass('gt-hidden');
} else {
$exclusiveWarning.addClass('gt-hidden');
@ -50,10 +50,10 @@ export function initCompLabelEdit(selector) {
$nameInput.val($(this).data('title'));
const $isArchivedCheckbox = $('.edit-label .label-is-archived-input');
$isArchivedCheckbox.prop('checked', this.hasAttribute('data-is-archived'));
$isArchivedCheckbox[0].checked = this.hasAttribute('data-is-archived');
const $exclusiveCheckbox = $('.edit-label .label-exclusive-input');
$exclusiveCheckbox.prop('checked', this.hasAttribute('data-exclusive'));
$exclusiveCheckbox[0].checked = this.hasAttribute('data-exclusive');
// Warn when label was previously not exclusive and used in issues
$exclusiveCheckbox.data('exclusive-warn',
$(this).data('num-issues') > 0 &&

View File

@ -67,10 +67,10 @@ export function initRepoEditor() {
$('.js-quick-pull-choice-option').on('change', function () {
if ($(this).val() === 'commit-to-new-branch') {
showElem($('.quick-pull-branch-name'));
$('.quick-pull-branch-name input').prop('required', true);
document.querySelector('.quick-pull-branch-name input').required = true;
} else {
hideElem($('.quick-pull-branch-name'));
$('.quick-pull-branch-name input').prop('required', false);
document.querySelector('.quick-pull-branch-name input').required = false;
}
$('#commit-button').text($(this).attr('button_text'));
});
@ -135,13 +135,13 @@ export function initRepoEditor() {
// Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage
// to enable or disable the commit button
const $commitButton = $('#commit-button');
const commitButton = document.getElementById('commit-button');
const $editForm = $('.ui.edit.form');
const dirtyFileClass = 'dirty-file';
// Disabling the button at the start
if ($('input[name="page_has_posted"]').val() !== 'true') {
$commitButton.prop('disabled', true);
commitButton.disabled = true;
}
// Registering a custom listener for the file path and the file content
@ -151,7 +151,7 @@ export function initRepoEditor() {
fieldSelector: ':input:not(.commit-form-wrapper :input)',
change() {
const dirty = $(this).hasClass(dirtyFileClass);
$commitButton.prop('disabled', !dirty);
commitButton.disabled = !dirty;
},
});
@ -163,7 +163,7 @@ export function initRepoEditor() {
editor.setValue(value);
}
$commitButton.on('click', (event) => {
commitButton?.addEventListener('click', (e) => {
// A modal which asks if an empty file should be committed
if ($editArea.val().length === 0) {
$('#edit-empty-content-modal').modal({
@ -171,7 +171,7 @@ export function initRepoEditor() {
$('.edit.form').trigger('submit');
},
}).modal('show');
event.preventDefault();
e.preventDefault();
}
});
})();

View File

@ -1,6 +1,6 @@
import $ from 'jquery';
import {updateIssuesMeta} from './repo-issue.js';
import {toggleElem, hideElem} from '../utils/dom.js';
import {toggleElem, hideElem, isElemHidden} from '../utils/dom.js';
import {htmlEscape} from 'escape-goat';
import {confirmModal} from './comp/ConfirmModal.js';
import {showErrorToast} from '../modules/toast.js';
@ -8,32 +8,42 @@ import {createSortable} from '../modules/sortable.js';
import {DELETE, POST} from '../modules/fetch.js';
function initRepoIssueListCheckboxes() {
const $issueSelectAll = $('.issue-checkbox-all');
const $issueCheckboxes = $('.issue-checkbox');
const issueSelectAll = document.querySelector('.issue-checkbox-all');
const issueCheckboxes = document.querySelectorAll('.issue-checkbox');
const syncIssueSelectionState = () => {
const $checked = $issueCheckboxes.filter(':checked');
const anyChecked = $checked.length !== 0;
const allChecked = anyChecked && $checked.length === $issueCheckboxes.length;
const checkedCheckboxes = Array.from(issueCheckboxes).filter((el) => el.checked);
const anyChecked = Boolean(checkedCheckboxes.length);
const allChecked = anyChecked && checkedCheckboxes.length === issueCheckboxes.length;
if (allChecked) {
$issueSelectAll.prop({'checked': true, 'indeterminate': false});
issueSelectAll.checked = true;
issueSelectAll.indeterminate = false;
} else if (anyChecked) {
$issueSelectAll.prop({'checked': false, 'indeterminate': true});
issueSelectAll.checked = false;
issueSelectAll.indeterminate = true;
} else {
$issueSelectAll.prop({'checked': false, 'indeterminate': false});
issueSelectAll.checked = false;
issueSelectAll.indeterminate = false;
}
// if any issue is selected, show the action panel, otherwise show the filter panel
toggleElem($('#issue-filters'), !anyChecked);
toggleElem($('#issue-actions'), anyChecked);
// there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
$('#issue-filters, #issue-actions').filter(':visible').find('.issue-list-toolbar-left').prepend($issueSelectAll);
const panels = document.querySelectorAll('#issue-filters, #issue-actions');
const visiblePanel = Array.from(panels).find((el) => !isElemHidden(el));
const toolbarLeft = visiblePanel.querySelector('.issue-list-toolbar-left');
toolbarLeft.prepend(issueSelectAll);
};
$issueCheckboxes.on('change', syncIssueSelectionState);
for (const el of issueCheckboxes) {
el.addEventListener('change', syncIssueSelectionState);
}
$issueSelectAll.on('change', () => {
$issueCheckboxes.prop('checked', $issueSelectAll.is(':checked'));
issueSelectAll.addEventListener('change', () => {
for (const el of issueCheckboxes) {
el.checked = issueSelectAll.checked;
}
syncIssueSelectionState();
});

View File

@ -533,7 +533,7 @@ export function initRepository() {
const gitignores = $('input[name="gitignores"]').val();
const license = $('input[name="license"]').val();
if (gitignores || license) {
$('input[name="auto_init"]').prop('checked', true);
document.querySelector('input[name="auto_init"]').checked = true;
}
});
}