mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
Decryption Retry All backend & desktop
This commit is contained in:
parent
4c3d37b311
commit
6f46d1985f
@ -63,11 +63,23 @@ class StatusScreenComponent extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
function renderSectionRetryAllHtml(key, retryAllHandler) {
|
||||
return (
|
||||
<a key={`retry_all_${key}`} href="#" onClick={retryAllHandler} style={retryStyle}>
|
||||
{_('Retry All')}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
const renderSectionHtml = (key, section) => {
|
||||
let itemsHtml = [];
|
||||
|
||||
itemsHtml.push(renderSectionTitleHtml(section.title, section.title));
|
||||
|
||||
if (section.canRetryAll) {
|
||||
itemsHtml.push(renderSectionRetryAllHtml(section.title, section.retryAllHandler));
|
||||
}
|
||||
|
||||
for (let n in section.body) {
|
||||
if (!section.body.hasOwnProperty(n)) continue;
|
||||
let item = section.body[n];
|
||||
|
@ -139,7 +139,7 @@ class ReportService {
|
||||
const decryptionDisabledItems = await DecryptionWorker.instance().decryptionDisabledItems();
|
||||
|
||||
if (decryptionDisabledItems.length) {
|
||||
section = { title: _('Items that cannot be decrypted'), body: [], name: 'failedDecryption' };
|
||||
section = { title: _('Items that cannot be decrypted'), body: [], name: 'failedDecryption', canRetryAll: false, retryAllHandler: null };
|
||||
|
||||
section.body.push(_('Joplin failed to decrypt these items multiple times, possibly because they are corrupted or too large. These items will remain on the device but Joplin will no longer attempt to decrypt them.'));
|
||||
|
||||
@ -157,6 +157,19 @@ class ReportService {
|
||||
});
|
||||
}
|
||||
|
||||
const retryHandlers = [];
|
||||
|
||||
for (let i = 0; i < section.body.length; i++) {
|
||||
if (section.body[i].canRetry) {
|
||||
retryHandlers.push(section.body[i].retryHandler);
|
||||
}
|
||||
}
|
||||
|
||||
if (retryHandlers.length > 1) {
|
||||
section.canRetryAll = true;
|
||||
section.retryAllHandler = () => Promise.all(retryHandlers.map(retryHandler => retryHandler()));
|
||||
}
|
||||
|
||||
sections.push(section);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user