Allow to mark files in a PR as viewed (#19007)

Users can now mark files in PRs as viewed, resulting in them not being shown again by default when they reopen the PR again.
This commit is contained in:
delvh 2022-05-07 20:28:10 +02:00 committed by GitHub
parent 59b30f060a
commit 5ca224a789
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 492 additions and 44 deletions

View file

@ -1,5 +1,6 @@
import $ from 'jquery';
import {svg} from '../svg.js';
import {invertFileFolding} from './file-fold.js';
function changeHash(hash) {
if (window.history.pushState) {
@ -148,10 +149,7 @@ export function initRepoCodeView() {
}).trigger('hashchange');
}
$(document).on('click', '.fold-file', ({currentTarget}) => {
const box = currentTarget.closest('.file-content');
const folded = box.getAttribute('data-folded') !== 'true';
currentTarget.innerHTML = svg(`octicon-chevron-${folded ? 'right' : 'down'}`, 18);
box.setAttribute('data-folded', String(folded));
invertFileFolding(currentTarget.closest('.file-content'), currentTarget);
});
$(document).on('click', '.blob-excerpt', async ({currentTarget}) => {
const url = currentTarget.getAttribute('data-url');