diff --git a/CHANGELOG.md b/CHANGELOG.md index f59d99a450..b3ec9910dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ * Widget schema can now follow the parent schema via the similar to introduced in the `array` field type syntax (`<` prefix). In order a parent followed field to be available to the widget schema, the area field should follow it. For example, if area follows the root schema `title` field via `following: ['title']`, any field from a widget schema inside that area can do `following: [' { + return { + docIds: [ ...docIds, ...!doc.archived ? [ doc._id ] : [] ], + archivedDocIds: [ ...archivedDocIds, ...doc.archived ? [ doc._id ] : [] ] + }; + }, { + docIds: [], + archivedDocIds: [] + }); + + await self.alterAttachment(existing, 'remove'); + await self.db.deleteOne({ _id: existing._id }); + await self.insert(req, file, { + attachmentId: attachment._id, + docIds: _.uniq([ ...docIds, ...existing.docIds || [] ]), + archivedDocIds: _.uniq([ ...archivedDocIds, ...existing.archivedDocIds || [] ]) + }); + }, + // Given a path to a local svg file, sanitize any XSS attack vectors that // may be present in the file. The caller is responsible for catching any // exception thrown and treating that as an invalid file but there is no diff --git a/modules/@apostrophecms/http/index.js b/modules/@apostrophecms/http/index.js index 5332f2be3f..9ddc605986 100644 --- a/modules/@apostrophecms/http/index.js +++ b/modules/@apostrophecms/http/index.js @@ -162,6 +162,7 @@ module.exports = { // `fullResponse` (if true, return an object with `status`, `headers` and `body` // properties, rather than returning the body directly; the individual `headers` are canonicalized // to lowercase names. If a header appears multiple times an array is returned for it) + // `originalResponse` (if true, return the response object exactly as it is returned by node-fetch) // // If the status code is >= 400 an error is thrown. The error object will be // similar to a `fullResponse` object, with a `status` property. @@ -225,6 +226,9 @@ module.exports = { options.jar.setCookieSync(cookie, url); }); } + if (options.originalResponse) { + return res; + } awaitedBody = true; body = await getBody(); if (res.status >= 400) { diff --git a/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue b/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue index 5036eb04d9..9d4eb57cd7 100644 --- a/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue +++ b/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue @@ -56,6 +56,7 @@ :labels="moduleLabels" :disable="relationshipErrors === 'min'" :displayed-items="items.length" + :checked="checked" :checked-count="checked.length" :module-name="moduleName" @page-change="updatePage" diff --git a/modules/@apostrophecms/job/index.js b/modules/@apostrophecms/job/index.js index 49b0f59e23..c254d0a4f9 100644 --- a/modules/@apostrophecms/job/index.js +++ b/modules/@apostrophecms/job/index.js @@ -242,7 +242,7 @@ module.exports = { await self.triggerNotification(req, 'completed', { count: total, dismiss: true - }); + }, results); // Dismiss the progress notification. It will delay 4 seconds // because "completed" notification will dismiss in 5 and we want // to maintain the feeling of process order for users. @@ -261,11 +261,18 @@ module.exports = { // array // No messages are required, but they provide helpful information to // end users. - async triggerNotification(req, stage, options = {}) { + async triggerNotification(req, stage, options = {}, results) { if (!req.body || !req.body.messages || !req.body.messages[stage]) { return {}; } + const event = req.body.messages.resultsEventName && results + ? { + name: req.body.messages.resultsEventName, + data: { ...results } + } + : null; + return self.apos.notification.trigger(req, req.body.messages[stage], { interpolate: { count: options.count || (req.body._ids && req.body._ids.length), @@ -277,6 +284,7 @@ module.exports = { action: options.action, ids: options.ids }, + event, icon: req.body.messages.icon || 'database-export-icon', type: options.type || 'success', return: true diff --git a/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue b/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue index 9aa1b5e083..82e0d4315c 100644 --- a/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue +++ b/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue @@ -124,6 +124,10 @@ export default { type: Number, required: true }, + checked: { + type: Array, + default: () => [] + }, checkedCount: { type: Number, required: true @@ -273,7 +277,7 @@ export default { modal, ...rest }) { await apos.modal.execute(modal, { - count: this.checkedCount, + checked: this.checked, moduleName: this.moduleName, ...rest }); diff --git a/modules/@apostrophecms/notification/ui/apos/components/AposNotification.vue b/modules/@apostrophecms/notification/ui/apos/components/AposNotification.vue index f602b0cb78..61a12eb189 100644 --- a/modules/@apostrophecms/notification/ui/apos/components/AposNotification.vue +++ b/modules/@apostrophecms/notification/ui/apos/components/AposNotification.vue @@ -71,6 +71,7 @@ export default { route: `${apos.modules['@apostrophecms/job'].action}/${this.notification.job._id}`, processed: 0, total: 1, + percentage: 0, action: this.notification.job.action } : null }; diff --git a/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue b/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue index 25a83b8834..888b3bd31d 100644 --- a/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue +++ b/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue @@ -70,6 +70,7 @@ :labels="moduleLabels" :displayed-items="items.length" :is-relationship="!!relationshipField" + :checked="checked" :checked-count="checked.length" :batch-operations="moduleOptions.batchOperations" :module-name="moduleName" diff --git a/modules/@apostrophecms/ui/ui/apos/scss/global/_theme.scss b/modules/@apostrophecms/ui/ui/apos/scss/global/_theme.scss index 8eb6c23db1..d33c815206 100644 --- a/modules/@apostrophecms/ui/ui/apos/scss/global/_theme.scss +++ b/modules/@apostrophecms/ui/ui/apos/scss/global/_theme.scss @@ -5,6 +5,7 @@ --a-success: #00bf9a; --a-success-fade: #00bf9a30; --a-warning: #ffce00; + --a-warning-dark: #a75c07; --a-warning-fade: #ffce0030; --a-progress-bg: #2c354d;