Skip to content

Commit

Permalink
fix isTrusted with check cell type
Browse files Browse the repository at this point in the history
  • Loading branch information
adigaboy committed Sep 7, 2023
1 parent 409bacc commit 1033071
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/notebook-extension/src/trusted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ const isTrusted = (notebook: Notebook): boolean => {
return false;
}
const cells = Array.from(model.cells);

const trusted = cells.reduce((accum, current) => {
if (current.trusted) {
return accum + 1;
} else {
return accum;
let total = 0;
let trusted = 0;

for (const current_cell of cells) {
if (current_cell.type !== 'code') {
continue;
}
total++;
if (current_cell.trusted) {
trusted++;
}
}, 0);
};

const total = cells.length;
return trusted === total;
};

Expand Down

0 comments on commit 1033071

Please sign in to comment.