Apostrophe CMS Main Site Forum Home

Apostrophe 2.74.0: server-side user notifications, showFields improvements and more


#1
  • Server-side code may now call apos.notify(req, 'This is a message') to send a message to the logged-in user associated with req. That message will pop up on the browser and will remain visible until they dismiss it. If the user is not logged in right now, they will see it when they do log in.

You may use %s to interpolate additional string arguments, and you may pass an options object with dismiss: true for a self-dismissing notification. You may also set the type option to error, warn or success for different visual treatments. For example:

apos.notify(req, 'Sorry, you did not win a shiny new %s!', req.piece.title, { type: 'error' });

The API is identical to that for apos.notify on the browser side, except that req must be passed as the first argument. Also the method returns a promise, which resolves when the notification has reached the database. You may also optionally pass a final callback for the same purpose. This is useful when sending a notification just before a task exits the process. The rest of the time you won’t need to worry about it.

  • In 2.73.0, an optional second argument, locale, was added to the date Nunjucks filter. As it turns out this was done in a way that could have a knock-on effect on later uses of date that did not specify a locale. This has been fixed and unit tests have been added. Thanks to Fredrik Ekelund.

  • The values of fields hidden via showFields are now saved to the database, as long as they contain no errors. This allows you to return to an old setting and discover all of its sub-settings intact.

  • By default, Apostrophe deletes old asset bundles from uploadfs (S3, azure, etc.) five minutes after the launch of the site. The assumption is that the deployment of static assets has reached all peer servers and there is no need to keep old assets around. The uploadfsBundleCleanup option to apostrophe-assets may now be set explicitly to false to prevent this, as may be needed if asset bundles are shared between sub-deployments that are made at greatly varying times.

  • When apostrophe-workflow is present, “Batch Commit” and other inappropriate options are no longer offered for groups, which are not subject to workflow.

Thanks to Michelin for making much of the above work possible via Apostrophe Enterprise Support.