diff --git a/app/javascript/shared/activestorage/ujs.js b/app/javascript/shared/activestorage/ujs.js index 8efd98b86..3f8109953 100644 --- a/app/javascript/shared/activestorage/ujs.js +++ b/app/javascript/shared/activestorage/ujs.js @@ -27,6 +27,8 @@ addUploadEventListener(INITIALIZE_EVENT, ({ target, detail: { id, file } }) => { addUploadEventListener(START_EVENT, ({ target, detail: { id } }) => { ProgressBar.start(id); + // At the end of the upload, the form will be submitted again. + // Avoid the confirm dialog to be presented again then. const button = target.form.querySelector('button.primary'); if (button) { button.removeAttribute('data-confirm'); diff --git a/app/javascript/shared/activestorage/uploader.js b/app/javascript/shared/activestorage/uploader.js index 20363e4a8..63cab306f 100644 --- a/app/javascript/shared/activestorage/uploader.js +++ b/app/javascript/shared/activestorage/uploader.js @@ -3,7 +3,7 @@ import ProgressBar from './progress-bar'; /** Uploader class is a delegate for DirectUpload instance - used to track lifecycle and progress of un upload. + used to track lifecycle and progress of an upload. */ export default class Uploader { constructor(input, file, directUploadUrl) { diff --git a/app/javascript/shared/remote-poller.js b/app/javascript/shared/remote-poller.js index 6aca55745..937810778 100644 --- a/app/javascript/shared/remote-poller.js +++ b/app/javascript/shared/remote-poller.js @@ -29,6 +29,13 @@ delegate('click', '[data-attachment-refresh]', event => { attachementPoller.check(); }); +// Periodically check the state of a set of URLs. +// +// Each time the given URL is requested, the matching `show.js.erb` view is rendered, +// causing the state to be refreshed. +// +// This is used mainly to refresh attachments during the anti-virus check, +// but also to refresh the state of a pending spreadsheet export. class RemotePoller { urls = new Set(); timeout;