Skip to content

Commit

Permalink
as per review - add fail handler and simplify result checker
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Nov 21, 2021
1 parent 0b1afca commit b4affc2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web_src/js/features/repo-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ 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) => {
Expand All @@ -118,12 +120,14 @@ export function initRepoDiffShowMore() {
type: 'GET',
url,
}).done((resp) => {
if (!resp || resp.html === '' || resp.empty) {
if (!resp) {
$target.removeClass('disabled');
return;
}

$target.parent().replaceWith($(resp).find('#diff-file-boxes .diff-file-body .file-body').children());
}).fail(() => {
$target.removeClass('disabled');
});
});
}

0 comments on commit b4affc2

Please sign in to comment.