mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-21 09:08:15 +08:00
Allow Loading of Diffs that are too large (#17739)
* Allow Loading of Diffs that are too large This PR allows the loading of diffs that are suppressed because the file is too large. It does not handle diffs of files which have lines which are too long. Fix #17738 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@ -94,13 +94,40 @@ export function initRepoDiffShowMore() {
|
||||
type: 'GET',
|
||||
url,
|
||||
}).done((resp) => {
|
||||
if (!resp || resp.html === '' || resp.empty) {
|
||||
if (!resp) {
|
||||
$('#diff-show-more-files, #diff-show-more-files-stats').removeClass('disabled');
|
||||
return;
|
||||
}
|
||||
$('#diff-too-many-files-stats').remove();
|
||||
$('#diff-files').append($(resp).find('#diff-files li'));
|
||||
$('#diff-incomplete').replaceWith($(resp).find('#diff-file-boxes').children());
|
||||
}).fail(() => {
|
||||
$('#diff-show-more-files, #diff-show-more-files-stats').removeClass('disabled');
|
||||
});
|
||||
});
|
||||
$(document).on('click', 'a.diff-show-more-button', (e) => {
|
||||
e.preventDefault();
|
||||
const $target = $(e.target);
|
||||
|
||||
if ($target.hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$target.addClass('disabled');
|
||||
|
||||
const url = $target.data('href');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url,
|
||||
}).done((resp) => {
|
||||
if (!resp) {
|
||||
$target.removeClass('disabled');
|
||||
return;
|
||||
}
|
||||
|
||||
$target.parent().replaceWith($(resp).find('#diff-file-boxes .diff-file-body .file-body').children());
|
||||
}).fail(() => {
|
||||
$target.removeClass('disabled');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user