This forum has moved, please join us on github discussions. We will keep these old posts available for reference. Thank you!

Apostrophe 2.42.0: promises (!) and other cool new things

Apostrophe 2.42.0 release notes

  • Promises have landed in Apostrophe. Calling toArray, toObject, toDistinct or toMongo on an Apostrophe cursor without a callback will return a promise. That promise will resolve to the expected result.

In addition, docs.insert, docs.update, pieces.insert, pieces.update, and pages.insert will all return a promise if invoked without a callback.

These are the most frequently invoked functions in Apostrophe that formerly required callbacks.

As always with promises, be sure to catch errors with .catch() at some level.

Note that the await keyword can now be used with these methods, as long as you’re running Node.js 8.x or newer or using Babel to provide that language feature.

  • Apostrophe’s custom Split CKEditor toolbar control now works correctly in 2.x. You can give your users the Split control to allow them to break up a large rich text widget in order to insert other types of widget “in the middle.” Note that the control name is now capitalized to match the way other CKEditor toolbar buttons are named.

  • You may now specify _url: 1 or _nameOfJoin: 1 in a projection when using Apostrophe’s find() methods. Native MongoDB projections naturally can’t see these “computed properties” because they don’t live in the database — they are computed “on the fly” after documents are fetched. However, Apostrophe now automatically adds the right underlying fields to the projection.

Only _url and the names of joinByOne or joinByArray fields are supported. It does not make sense to use a projection on people to locate IDs that are actually attached to products via joinByOneReverse or joinByArrayReverse.

This feature does not conflict with legitimate uses of MongoDB projections because Apostrophe discards all properties beginning with _ when writing to the database, except for _id.

  • The length property of an Apostrophe attachment object is now correctly populated with the original file size. Thanks to David Keita. Note that images are also made available in many scaled sizes. Also the original may be replaced with a correctly rotated version, in which case length will not match. So the most useful scenario for this property is likely to be in working with office formats, especially PDF which can sometimes be very large.

  • Fixed bug in the isEmpty methods for areas and singletons. Thanks to David Keita.

apostrophe-workflow 2.5.0 release notes

  • Beginning with this release, the private-locales permission is enforced. You must give out the “View Private Locales” permission to your editors via groups in the admin bar. If you are still using hardcoded groups via the groups option of the apostrophe-users module, you must add the private-locales permission to relevant groups and restart. However we recommend commenting out the groups option if you’re using workflow; odds are you have a need to manage groups and their permissions through the UI at this point.

Users with the global admin permission do not need to be given this permission separately.