UNPKG

225 kBMarkdownView Raw
1# Changelog
2
3## 2.111.0 (2020-08-12)
4
5* By popular request, "Add Widget" dropdown menus are better organized now, with support for categories of widgets. You can configure this optional feature like so:
6
7```
8apos.area(data.page, 'areaNameHere', {
9 widgets: { ... you must configure your widgets as usual ... }
10 widgetGroups: {
11 'Content': [ 'apostrophe-rich-text', 'apostrophe-images' ],
12 'Layout': [ 'one-column', 'two-column' ]
13 }
14}
15```
16
17Every widget type you specify for `widgetGroups` must still be configured in `widgets`.
18
19If `widgetGroups` is not present the "add widget" dropdown menu will appear as it always did.
20
21* Removes the `aposBody` template macro, which was unused.
22
23## 2.110.0 (2020-07-29)
24
25* Security: added support for throttling login attempts. If you set the `throttle` option of `apostrophe-login` to `{ allowedAttempts: 3, perMinutes: 1, lockoutMinutes: 1 }`, a user will be locked out and unable to try again for 1 minute after three failed login attempts in 1 minute. Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
26* Schemas: you may now set a regular expression to be used to validate any `string` schema field by setting the `pattern` property of the schema field. **Please note
27that `pattern` must be a string,** not a regular expression literal. Otherwise it
28will only be validated on the server side, causing confusion for the user when it
29is not reported on the browser side. You may also set `patternErrorMessage` to
30provide a clear explanation to the user when their input does not match. When
31setting `pattern` as a string always remember to escape the `\` character properly
32(you will often need two `\` characters, for instance `\\w`). To avoid Denial of Service attacks, take care to avoid [evil regular expressions](https://en.wikipedia.org/wiki/ReDoS).
33* Security: added an `apostrophe-login:before` promise event which is emitted with `(req)` before a login attempt is evaluated. If a handler throws a string as an error, that string is internationalized and displayed as a login error, otherwise login proceeds normally. This can be used to implement features like the new `apostrophe-login-recaptcha` module, which you can install separately.
34* Security: to ease implementation of `apostrophe-login-recaptcha`, the login form now has `data-apos-login-form` and `data-apos-login-submit-button` attributes on the appropriate elements.
35* Security: when requiring Google Authenticator or a similar app for login (TOTP), you may now limit the requirement to certain groups, by passing a setting like `totp: { groups: true }` to the `apostrophe-login` module rather than just `totp: true`. Admins may then select which groups actually require TOTP by selecting it when editing the group (look at the permissions tab). In addition, the existing `totp` option has been added to the module documentation.
36
37## 2.109.0 (2020-07-15)
38
39* Add [heic-to-jpeg-middleware](https://github.com/boutell/heic-to-jpeg-middleware) to support uploading `heic/heif` images (the standard format for recent iPhones/iPads). Many thanks to Gabriel L. Maljkovich for their contributions to the underlying middleware as well as the integration with Apostrophe.
40* Add CSS to maintain spacing of admin UI.
41
42## 2.108.1 (2020-07-01)
43
44* Updates documentation of the `clonePermanent` utility method.
45* The http response to dismissing a notification should not include any information about the mongodb connection. The response previously included relatively low-risk information, including the IP address of the MongoDB server but not enough to make an unauthorized connection when the MongoDB server and/or firewall are properly configured.
46
47## 2.108.0 (2020-06-07)
48
49* UX improvement: if a piece type has the `contextual: true` option set and workflow is present, do not default published to `false`. There is already a good opportunity to review before the public sees the piece afforded by workflow.
50
51* If called with a scalar argument, `apos.utils.clonePermanent` now returns scalars (strings, booleans, numbers) as-is. This makes it easier to use the method when the argument might or might not be an object that requires cloning.
52
53## 2.107.2 (2020-06-10)
54
55* Fixed a regression that caused difficulty saving array fields with `color` subfields in their schema. This regression was introduced in 2.107.0.
56
57## 2.107.1 (2020-06-03)
58
59* The `distinctCounts` feature (also known as `counts: true` for `piecesFilters`) is now compatible with the `apostrophe-db-mongo-3-driver` module, when in use. Note that there is little benefit to that module now that `emulate-mongo-2-driver` is standard in Apostrophe and employs the MongoDB 3.x driver under the hood but provides a 2.x-compatible API. However those who strongly prefer the 3.x driver APIs for direct MongoDB queries may use `apostrophe-db-mongo-3-driver` with more confidence given this fix.
60
61## 2.107.0 (2020-05-20)
62
63* CKEditor has been updated to version 4.14, addressing a low-risk XSRF vulnerability. The vulnerability required that the source code editor feature be activated and that a user with editing privileges be convinced to import specially crafted markup, which is unlikely in practice.
64* Users may now intentionally clear a `time` field, whether or not it has a `def` setting, in which case it is stored as `null` (unless `required: true` is present). The inability to do this was a regression introduced in version 2.102.0.
65* Developers can now pass a `spectrumOptions` object to a `color` field and take full control of Spectrum, the plugin that powers Apostrophe's color picker. [Documentation for this configuration here.](https://docs.apostrophecms.org/reference/field-types/color.html#example)
66* Activating the `objectNotation` option to `i18n` no longer causes problems for certain strings in Apostrophe's admin interface, which does not use it. You will see alternate Unicode characters for the `:` and `.` characters in these strings if you do choose to translate them. These are transformed back for end users.
67
68## 2.106.3 (2020-05-06)
69
70* Fixes a page tree interface bug that would cause pages to be lost when they
71were trashed with their parent, then the parent was dragged out of the trash.
72This only effected projects with `trashInSchema: true` set in the
73`apostrophe-docs` module, however that includes anything using
74`apostrophe-workflow`.
75
76## 2.106.2 (2020-04-22)
77
78* The icons of custom CKEditor plugins now appear properly. Previously they were hidden.
79* Switched the continuous integration testing service to CircleCI from Travis.
80
81## 2.106.1 (2020-04-20)
82
83* Fixed a regression that broke the thumbnail display of images in "Manage Images." This regression was introduced in version 2.106.0, which was otherwise an important security update, so you should definitely update to 2.106.1 to get the benefit of that security fix if you haven't already.
84
85## 2.106.0 (2020-04-17)
86
87**Security:** the `list` route of the `apostrophe-pieces` module and the `info` route of the `apostrophe-pages` module formerly allowed site visitors to obtain the complete contents of publicly accessible pages and pieces. While there was no inappropriate access to documents that were unpublished, restricted to certain users, etc., properties not normally visible to end users were exposed. Since the global document can be fetched as part of requests made by the public, this means that any credentials in the schema of the global document are vulnerable to being viewed until your site is updated to at least Apostrophe 2.106.0. Note that if you are using Apostrophe Workflow you must also update that module to Apostrophe 2.34.0, otherwise the "Manage Workflow" view will not work.
88
89The most important change made to resolve this issue is the use of a projection to populate the "Manage" view of pieces (the "list" route). While Apostrophe will automatically include any extra columns configured with `addColumns` in the projection, you may need to add additional properties to the projection if you have overridden the manage list view template entirely for some of your pieces to display additional information.
90
91The easiest way to do that is to configure the `addToListProjection` option for your custom piece type, like so:
92
93```javascript
94// in lib/modules/my-module
95module.exports = {
96 extend: 'apostrophe-pieces',
97 addToListProjection: {
98 myExtraProperty: 1
99 }
100 // other configuration here as usual
101}
102```
103
104You can also apply the `super` pattern to the new `getListProjection` method of `apostrophe-pieces`.
105
106Many thanks to Kristian Mattila for bringing the issue to our attention, allowing us to patch the vulnerability
107before any public disclosure was made. If you become aware of a security issue in Apostrophe, please contact
108us via email at [security@apostrophecms.com](mailto:security@apostrophecms.com).
109
110## 2.105.2 (2020-04-09)
111
112* `apos.utils.emit` now works properly in IE11, addressing an issue that impacted `apostrophe-forms` submissions in IE11 in 2.105.0.
113* IE11 now respects the `prefix` option properly in `apos.utils.get` and `apos.utils.post` (lean mode helpers for making API calls).
114
115## 2.105.1 (2020-04-08)
116
117* When using lean mode, video widgets did not support Internet Explorer 11. This issue has been fixed. Non-lean mode video widgets have always supported Internet Explorer 11.
118* If the `jQuery: 3` option is not passed to `apostrophe-assets` a developer warning is now printed at startup. The use of jQuery 1.x is deprecated. All Apostrophe-published modules work fine with the `jQuery: 3` option. You may need to review the jQuery 3 changelogs for a few changes required for your own legacy code.
119* Users may now intentionally clear a `date` field, whether or not it has a `def` setting, in which case it is stored as `null` (unless `required: true` is present). The inability to do this was a regression introduced in verion 2.102.0.
120* The `objectNotation: true` option to `apostrophe-i18n`, which we pass on to the `i18n` module, is now compatible with the `namespaces: true` option. When both are active, the namespace separator defaults to `<@>` to avoid a conflict with the `:` character used to begin the default value when using object notation.
121* Various documentation corrections and minor aesthetic improvements.
122
123## 2.105.0 (2020-03-26)
124
125* Security: Node 6.x has not been supported by its creators since April 2019, and Node 8.x reached its end of support date in December 2019. **As of this release of Apostrophe, we are officially acknowledging that it is not possible to maintain support for Node 6.x in Apostrophe and it is unlikely to work on that version,** since both the testing frameworks on which we rely and common sub-dependencies of essential open source modules used by Apostrophe now require Node 8 at a minimum. While we will make a good-faith effort to maintain Node 8.x usability as long as possible, we expect to similarly be forced to drop Node 8 compatibility soon. **Both Node 6 and Node 8 might not be safe to use for reasons entirely unrelated to Apostrophe**, so you should upgrade your servers as soon as practical. Few or no code changes should be needed in Apostrophe 2.x projects. **We strongly recommend moving to Node 12.x,** the most up to date LTS (Long-Term Support) release of Node. In the future, we recommend becoming familiar with the [Node.js release schedule](https://nodejs.org/en/about/releases/) so you can better plan for such upgrades.
126* Security: all of the recently new `npm audit` warnings were fixed. These were considered `low` risk according to the `npm audit` tool. In the process we removed dependencies on the `tar` and `prompt` modules in favor of simpler solutions with fewer moving parts.
127* Lean mode: the `apos.utils.get` and `apos.utils.post` methods no longer prepend the site's global `prefix` when the call targets a different origin (another site's API, for instance). This is a bug fix to match the behavior of `$.jsonCall()` which set the standard for this in Apostrophe.
128* Lean mode: `apos.utils.emit(el, name, data)` has been introduced. This method emits a custom DOM event with the given `name` and adds the properties of the `data` object to the event. The event is emitted on `el`. When emitting events with global significance, our convention is to emit them on `document.body`. To listen for such events one uses the standard browser method `document.body.addEventListener('eventname', function(event) { ... })`.
129* Lean mode: `apos.utils.get` now emits an `apos-before-get` event with `uri`, `data` and `request` properties just before the request is actually sent. You may use this hook to add headers to `request`.
130* Cloud deployment: when starting up a site with `APOS_BUNDLE=1`, the asset bundle is by default extracted to the root of the project so that the assets can be found in the filesystem of each server if needed. New feature: for the benefit of environments in which the bundle files are already present and the root of the project is not writable, `APOS_EXTRACT_BUNDLE=0` may now be set to disable the extraction (note `0`, not `1`).
131* Localization: Apostrophe's static i18n of its user interface can now be "namespaced," opening the door to giving your translators better guidance on whether to translate it or ignore it when working with the JSON files in the `locales/` folder of your site. You can turn this on by enabling the `namespaces: true` option for the `apostrophe-i18n` module. When you do, Apostrophe's i18n phrases will be prefaced with `apostrophe<:>` in the JSON files (not in the browser). You can create your own namespaced translations by calling `__ns('namespacename', 'phrase')` rather than `__('phrase')`, `__ns_n` rather than `__n`, etc. Note that if the namespaces option is not actually turned on, these new helpers are still available in templates; they just don't prefix a namespace. The forthcoming `apostrophe-static-i18n` module, which allows for editing static translations as pieces, will also have an option to ignore a namespace, which is helpful if you wish to avoid showing our user interface phrases to your translation team at all.
132
133## 2.104.0 (2020-03-11)
134
135* `apos.utils.get` and `apos.utils.post` now return a promise if invoked without a callback. This means you may use `await` with them. *It is up to you to provide a `Promise` polyfill if you use this feature without callbacks and intend to support IE11. For instance you could use the `core-js` library.* These methods are similar to `$.get` and `$.post` but do not require jQuery. `apos.utils.post` supports Apostrophe's CSRF protection natively so you do not have to add an exception if you use it. These methods are available in [lean frontend mode](https://docs.apostrophecms.org/apostrophe/core-concepts/front-end-assets/lean-frontend-assets).
136* `apos.utils.get` no longer adds an unnecessary `?` to the URL it fetches if `data` has no properties. In addition, `apos.utils.get` leaves the URL unchanged if `data` is null.
137* Recursion warnings now include a hint to add a projection to pieces-widgets as well as more obvious joins.
138* Dependencies updated to reflect latest version of `emulate-mongo-2-driver`, which contains an important fix to `count`.
139
140## 2.103.1 (2020-03-04)
141
142* An incompatibility with apostrophe-headless was introduced in Apostrophe 2.102.0. This version addresses that incompatibility, however you must also upgrade apostrophe-headless to version 2.9.3. The issue had to do with a change that was made to allow users to intentionally clear default values in forms. We are updating our regression test procedures to ensure that if a new release of apostrophe would break the unit tests of apostrophe-headless, it will not be published until that issue is resolved.
143
144## 2.103.0 (2020-03-02)
145
146* Frustrations with conflict resolution have been much improved. First, Apostrophe no longer displays the "another user has taken control of the document" message multiple times in a row. Second, due to changes in what browsers allow to happen when you leave the page, beginning in version 2.102.0 Apostrophe displayed too many messages about a conflict with your **own** work in another tab. We no longer display these messages. However, if there really *is* work lost for the same document in another tab, Apostrophe will still tell you what happened in order to teach the habit of not editing the same page in two tabs simultaneously.
147* You may now use `select` schema field with dynamic choices as a filter in "Manage Pieces."
148* `required` is now enforced on the server side for `joinByOne`. However, note that it is always possible for the document you joined with to be moved to the trash at a later time. You must therefore always check that the join was really loaded before relying on it. Thanks to Ricardo José Rodríguez Álvarez.
149* Hidden information at the bottom of certain modals has been restored to view.
150
151## 2.102.5 (2020-02-26)
152
153* Explicitly require emulate-mongo-2-driver 1.2.1 or better, to address a bug in 1.2.0.
154
155## 2.102.4 (2020-02-25)
156
157* Explicitly require emulate-mongo-2-driver 1.2.0 or better, which provides a deprecation-free wrapper for `count` and fixes bugs in the wrapper for `aggregate`.
158
159## 2.102.3 (2020-02-24)
160
161* Security fix for [Prototype Override Protection Bypass vulnerability in the qs module](https://snyk.io/vuln/npm:qs:20170213). It appears this risk only occurs when our `build` Nunjucks filter is used in conjunction with a URL based on what the browser sent, rather than starting with the `_url` property of the page and adding parameters to that with `build`, thus it is not an issue "out of the box" in all or most ApostropheCMS sites. However the vulnerability should be patched promptly because it could definitely exist in current or future project level code that uses `build`. To eliminate the risk, update to this version of Apostrophe and make sure you "npm update" to get the required updated version of `qs` via Apostrophe's dependencies.
162
163* This version also corrects a bug that prevented the recently released disableInactiveAccounts feature from working.
164
165## 2.102.2 (2020-02-11)
166
167* Removed the restriction preventing the use of `mongodb+srv` connection
168URIs with MongoDB. `emulate-mongo-2-driver` has no problem with these, since
169it passes them on to the 3.x driver.
170* Updated dependency to `emulate-mongo-2-driver` 1.1.0, which knocks out 100% of the common MongoDB deprecation warnings when using Apostrophe, with one exception: you should set the `useUnifiedTopology: true` option yourself. We do not do this for you because we cannot break legacy configurations using other topologies. However most of you can just turn this option on and enjoy more reliable connections and no more warnings.
171
172Here is how to configure that in Apostrophe:
173
174```javascript
175// in app.js, where your modules key is...
176modules: {
177 'apostrophe-db': {
178 connect: {
179 useUnifiedTopology: true
180 }
181 }
182}
183```
184
185## 2.102.1 (2020-02-10)
186
187* Temporarily pinned to `less` version 3.10.x to work around an
188[upstream bug](https://github.com/less/less.js/issues/3469) that broke
189deployments.
190
191## 2.102.0 (2020-01-30)
192
193* Apostrophe now displays "Saving... Saved" indicators near the context
194menu in the lower left indicator. In our UX tests, users often did not
195realize Apostrophe automatically saved their work and were concerned
196by the lack of an explicit save button. In addition, Apostrophe no longer
197attempts to save your remaining changes via a synchronous HTTP request when you
198close the page, because this is deprecated in all browsers and disabled
199in many. Instead, Apostrophe uses the standard "you have unsaved changes,
200are you sure you wish to leave this page?" dialog. Together with the
201"saving... saved" indicator, this provides a mechanism for preventing
202lost work that is robust in modern browsers.
203
204This does impact Apostrophe's "advisory locking" mechanism that warns users
205if another user is already editing. Since we cannot guarantee a synchronous
206request to unlock the page will ever be received, we have instead
207shortened the expiration time for document locks to 30 seconds. Since
208these are refreshed every 5 seconds there should be no negative impacts
209in typical use.
210
211Thanks to Freshworks for making this improvement possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
212
213* New `disableInactiveAccounts` option, which can be set like so:
214```javascript
215 'apostrophe-users': {
216 disableInactiveAccounts: true
217 }
218```
219
220By default, users from the "admin" group are whitelisted and the inactivity period is 90 days. This can be changed:
221
222```javascript
223{
224 // in your project level lib/modules/apostrophe-users/index.js file
225 disableInactiveAccounts: {
226 neverDisabledGroups: [ 'test', 'otherGroup' ],
227 // After 30 days without logging in, the account is marked disabled
228 // on next login attempt, until an admin explicitly enables it again
229 inactivityDuration: 30
230 }
231}
232```
233
234* A longstanding bug relating to schemas has been fixed. Previously, if you attempted to clear a string field that had a `def` property, that field would be repopulated with the `def` value. This was never intended; `def` is only for the initial population of a newly created object. If you were relying on this bug, update your code to use `apos.schemas.newInstance(schema)` from the start so that you begin with an object that has the right defaults for each field. Note that pieces, pages, etc. already do this.
235
236* Added a `bodyAttributes` block to `outerLayoutBase.html`. You may override this block to add new attributes to `body` without overriding the entire `outerLayoutBase.html` template. It is a best practice to not override this template, use the provided blocks.
237
238* Fields of type `attachment` with `required` not set to `true` now work properly.
239
240* You may now set the `loginUrl` option of the `apostrophe-login` module to change the login URL from `/login` to something else. Thanks to Giuseppe Monteleone for this contribution.
241
242* `help` property is now supported for array fields.
243
244* Uploads with a capitalized file extension are now accepted where appropriate. Thanks to Fernando Figaroli for this contribution.
245
246* When editing a join with pages, a nonfunctional edit pencil icon is no longer displayed. Actual inline editing of page settings from another page may be a 3.0 feature.
247
248## 2.101.1 (2020-01-08)
249
250* Dependency on `emulate-mongo-2-driver` is now explicitly set to require at least version 1.0.3 to bring in various fixes.
251* Reported `landscape` and `portrait` properties of an image attachment object now correspond to the crop in use, if any.
252
253## 2.101.0 (2019-12-14)
254
255* Due to `npm audit` security vulnerability warnings and the end of upstream support, the 2.x version of the `mongodb` npm module (the driver we used to connect to MongoDB, not MongoDB itself) can no longer be responsibly used in Apostrophe. Therefore we have replaced it with the new [emulate-mongo-2-driver](https://www.npmjs.com/package/emulate-mongo-2-driver) module, which strives to match the interface of the MongoDB driver version 2.x while acting as a wrapper for the official, supported MongoDB driver version 3.x. This has been tested in many projects. Therefore no code changes should be required for your project to `npm update` to version 2.101.0. However if you encounter incompatibilities, most likely in driver features not used in Apostrophe, please [contribute additional wrappers and test coverage to emulate-mongo-2-driver](https://www.npmjs.com/package/emulate-mongo-2-driver). Another option is to use [apostrophe-db-mongo-3-driver](https://www.npmjs.com/package/apostrophe-db-mongo-3-driver), which allows you to use the 3.x driver API directly and also provides a `findWithProjection` collection method as a migration path for quickly patching legacy code.
256* The `def` property of schema fields associated with specific page types is now displayed in the editor when creating new pages. Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
257* A schema field named `fields` can now be included in a projection without surprising behavior.
258* EPS (`.eps`) files are now accepted as Apostrophe attachments and categorized in the `office` group, meaning they can be uploaded as "files."
259* The `aspectRatio` option, when specified directly for attachment schema field properties, now implies permission to crop as forced center-cropping differed from what we do when applying aspect ratios to image widgets.
260* Cross-browser fix for the back button when using our page-refresh-free AJAX features for browsing pieces. Thanks to sergiodop92 for this fix.
261
262## 2.100.3 (2019-12-03)
263
264* The `aspectRatio` option to the `attachments` schema field type is now fully implemented. We always had this for selecting images, e.g. in our `apostrophe-images-widgets` module, but it is now also available when directly using an `attachment` schema field as a property of your own doc. You can also set `crop: true` to allow manual cropping in that case. This is a useful technique when including the image in a reusable media library does not make sense.
265
266## 2.100.2 (2019-12-02)
267
268* Corrected a significant performance problem with the `apostrophe-users:add` command line task when thousands of users exist.
269
270## 2.100.1 (2019-11-21)
271
272* Must confirm when resetting password, since there are no do-overs if we do not have the email confirmation method available (with `resetLegacyPassword: true`) and since it's generally a pain not to have this.
273* Fixed the "Reset TOTP authentication" feature of "Manage Users".
274
275## 2.100.0 (2019-11-21)
276
277* New feature: Google Authenticator two-factor authentication (TOTP) support for Apostrophe accounts. Set the `totp: true` option of the `apostrophe-login` module. When enabled, users (including admins) are required to set up and complete authentication with Google Authenticator or a compatible TOTP app on their mobile device. On the user's next login they set up Google Authenticator; after that they must supply a code from Google Authenticator at each login. If a user loses their device, an admin can reset their access by editing that user via "Manage Users" and selecting "Reset TOTP 2-Factor Authentication." If the admin loses their device, they can use the new `apostrophe-users:reset-totp` command line task. Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
278* New feature: `resetLegacyPassword: true` option for `apostrophe-login`. When the `passwordRules` and `passwordMinLength` options are present, enabling `resetLegacyPassword` permits the user to change their password right away at login time if it is correct, but does not meet your new standards for adequate passwords. This does not require receiving a confirmation email; if you are concerned by that, consider enabling `passwordReset` instead if you are willing to [configure email delivery](https://docs.apostrophecms.org/apostrophe/tutorials/howtos/email). Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
279* New feature: `resetKnownPassword: true` option for `apostrophe-login`. When enabled, a currently logged-in user is permitted to change their own password without receiving an email, as long as they know their current password. This adds an additional admin bar item, which you may want to group. Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
280* Performance: Apostrophe is now much faster when editing a piece with hundreds of areas in its schema. Thanks to Bharathkumar Chandrasekaran of Freshworks for his contributions to finding the solution.
281* Bug fix: `passwordRules` and `passwordMinLength` no longer break support for new users created via `apostrophe-passport` who use single sign-on and do not have explicit passwords in Apostrophe.
282* Developer warning: a module that implements a widget must have a name ending in `-widgets` or the editor will not work properly in the browser. We now display a warning.
283* Developer warning: if the developer tries to configure `piecesFilters` for the pieces module, rather than the corresponding pieces-pages module, a warning is displayed.
284* UI fix: modal dialog box height corrected. Thanks to Paul Grieselhuber for this contribution.
285* UI fix: better Microsoft Edge support. Thanks to Denis Lysenko.
286
287## 2.99.0 (2019-10-30)
288
289* Optional password complexity rules. You may set `passwordMinLength` to a number of your choice. You may also set `passwordRules` to an array of rule names. Those available by default are `noSlashes`, `noSpaces`, `mixedCase`, `digits`, and `noTripleRepeats`. To block **existing** passwords that don't meet this standard, you should also set `passwordRulesAtLoginTime: true`. Additional password rules may be registered by calling `apos.login.addPasswordRule('name', { test: fn, message: 'error message' })`. The function will receive the password and must return `true` if it is acceptable. Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
290* `apos.utils.attachmentUrl` has been added to lean mode. It works exactly like `apos.attachments.url`, which is not available in lean mode, with one exception: to avoid adding more overhead to lean mode, the default size is the original. So you must take care to specify the `size` option for performance when working with images.
291* When an in-page edit is made and an area is updated as a result, the `update` method of the appropriate module is now called, rather than `apos.docs.update`. This allows for `beforeSave`, etc. to fire in this situation. Thanks to Kalia Martin of swiss4ward for this contribution.
292* Apostrophe now provides a `res.rawRedirect` method, which performs a redirect without adding the sitewide prefix. On sites without a prefix it is equivalent to `res.redirect`. This is useful when working with a URL that is already prefixed, such as the `_url` property of a page or piece.
293* Using the `groups` option to `apostrophe-users` together with a very large database can lead to slow startup because the groups are found by title, and title is not an indexed field. You may now specify the `slug` for each group in the array, in which case they are found by `slug` instead, which is an optimized query. However most very large sites would be better off removing the `groups` option and allowing groups to be managed flexibly via the admin bar.
294* `apos.tasks.getReq` now provides more simulated i18n support.
295* The occasional but irritating "not blessed" bug when editing content on the page has been fixed via a new "reinforced blessing" mechanism.
296
297## 2.98.1 (2019-10-21)
298
299* When selecting pages for a join, you are now permitted to choose any page you have access to view. This was never intended to be locked down to pages you can edit. For instance, you should be able to link to any page you can see when editing a navigation widget. Thanks to Freshworks for making this fix possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
300* Beginning with this version we are whitelisting `npm audit` advisories that are not relevant to Apostrophe. Specifically, advisory `1203` has no bearing on Apostrophe because end users cannot specify collection names to MongoDB via Apostrophe.
301
302## 2.98.0 (2019-10-11)
303
304* Bug fix: the `sendPage` method now emits the `apostrophe-pages:beforeSend` promise event no matter which module is calling `self.sendPage`. This was always the intention, as shown by the fact that the legacy `pageBeforeSend` method is called. The purpose of `sendPage` has always been to allow a custom route to render a page exactly as Apostrophe normally does, and that includes calling all `apostrophe-pages:beforeSend` handlers.
305* Bug fix: the `title` field is now required in the `apostrophe-users` module. Thanks to Jose Garcia of swiss4ward.
306* The `apostrophe-templates` module now has an internal `i18n` method intended to be overridden by those who want to monitor and/or alter static internationalization results. This will be used by the forthcoming `apostrophe-i18n-debugger` module. You don't need to call this method, you can use the standard [i18n](https://www.npmjs.com/package/i18n) helpers.
307
308## 2.97.2 (2019-10-03)
309
310* All [i18n](https://www.npmjs.com/package/i18n) helpers are now available in templates, not just the `__` helper. See the [i18n module documentation](https://www.npmjs.com/package/i18n) for more information. Test coverage was added to ensure this remains in place.
311* UX improvements in "reorganize" (Manage Pages).
312* contributing.md now points to the [apostrophecms Discord chat community](https://chat.apostrophecms.org) for live community help, rather than Gitter, which has been retired.
313
314## 2.97.1 (2019-09-26)
315
316* Hotfix for a potential Denial Of Service issue reported by NPM. A user with login privileges could eventually exhaust available memory by submitting thousands of batch job requests.
317
318## 2.97.0 (2019-09-25)
319
320* The simplified `APOS_BUNDLE=1` feature for asset deployment in the cloud now uses the actual `tar` utility when extracting assets locally, rather than the `tar` npm module, as a blocking bug was encountered and the actual utility is faster.
321* Improved support for subclasses of `apostrophe-rich-text-widgets`. These now receive the same CSS UX considerations and store their content under the appropriate widget name. This opens the door to the new `tiptap` option offered by the latest release of [apostrophe-tiptap-rich-text-widgets](https://github.com/apostrophecms/apostrophe-tiptap-rich-text-widgets), which can be used to selectively enable or disable the use of tiptap as an alternative to CKEditor for some subclasses but not others.
322* Low-level support for namespacing asset themes. By default this has no effect, however if getThemeName is overridden to return a theme name then asset masters, minified assets, bundles in the collection, etc. all get namespaced to play side by side with other themes used by other apos objects in the same project. Meant for use with apostrophe-multisite, this is not equivalent to a Wordpress or Drupal theme as such.
323* The widget editor's `afterShow` method takes no callback; removed an invocation that did not make sense. Thanks to Amin Shazrin for this contribution.
324* Improved sizing for video widgets. This is now based on the parent element. Also added empty alt tag to the placeholder image as a hint not to read it aloud.
325
326Thanks to Michelin for making much of this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
327
328## 2.96.2 (2019-09-17)
329
330* Bug fix: missing required fields nested in `array` or `object` fields hidden fvia `showFields` no longer result in a server-side error. They adhere to the usual rule that if you can't see it, you're not expected to enter it.
331* Bug fix: autocomplete now works again for tags and joins. This was caused by a difference of z-index introduced by an upgrade of jQuery UI in July.
332* Better UX for drag and drop.
333* The `findTestModule` method now works properly in Windows, opening the door to testing Apostrophe modules more easily on Windows. Thanks to Amin Shazrin for this contribution.
334* The base name of the master stylesheet has been factored out to a `getStylesheetsMasterBase` method in `apostrophe-assets`, for easier overrides in multisite projects.
335* Thanks to refactoring of the implementation, it is now possible to override the behavior of the `apostrophe-email` module to use different transports in different circumstances. Thanks to Aurélien Wolz for this contribution.
336
337## 2.96.1 (2019-09-09)
338
339* Setting PORT to `0`, or passing `0` as the `port` option to `apostrophe-express`, now works per the TCP documentation: you get a random port number. You can access that port number as `apos.modules['apostrophe-express'].port`. Thanks to J. Garijo for this contribution.
340* The ability to add a new image while selecting one for a widget has been restored. Similar scenarios while editing other joins are also fixed.
341* Double-clicking the "Edit" button of a widget no longer causes a race condition. Thanks to Mayank Bansal for pointing out the issue and how to reproduce it.
342* Undisplayed tooltips no longer take up space in a way that causes interface frustration.
343
344## 2.96.0 (2019-09-04)
345
346* Reverse joins no longer result in an empty tab when they are the only unarranged field, since they have no editing UI in any case.
347* The "context menu" (aka "Page Settings," "Published," etc.) has been cleaned up in several ways. It no longer appears unless the user at least has edit access to either `data.page` or `data.piece`. This deciding factor can be altered by overriding `apos.templates.showContextMenu`, which accepts `req` and must return `true` or `false`. In addition, the "Unpublished" dropdown works properly in all cases.
348* Notifications now have an explicit "close" button to help those who did not realize they were clickable. Also, they display the proper cursor when hovered and use a suitable HTML tag for improved accessibility.
349
350## 2.95.1 (2019-09-01)
351
352* Drag and drop operations within an area, and various other operations, no longer result in a race condition where the same document is locked more than once and content can be lost. This is especially noticeable on slower connections but can happen anytime. This was a longstanding problem. Thanks to Eric Wong for his patient reporting and testing of this issue.
353* eslint has been updated, addressing npm audit complaints.
354
355## 2.95.0 (2019-08-21)
356
357* Nested content in sub-areas is no longer lost when editing schema properties of the widget that contains the areas.
358* The `slugPrefix` option for pieces modules now works correctly. This option prefixes the slugs of all pieces of that type with the given string. It is recommended, but not required, that the prefix end in `-`. The editor requires that the slug be prefixed with the `slugPrefix`, the editor suggests slugs that include the prefix, and a migration now runs to add the `slugPrefix` to pieces that lack the prefix. If this results in a slug conflict the offending piece is left alone and flagged for your manual attention. A slug without the prefix does not cause any harm, other than cluttering up the namespace of slugs.
359* `apostrophe-images` and `apostrophe-files` now use the `slugPrefix` option to prefix their slugs. This will result in a **one-time** migration for each at startup, after which your image and file slugs will no longer be in frequent conflict with other pieces when you try to give them friendly slugs. Note that **image and file slugs are not used in actual media asset filenames**, so there is no bc break there. And although most sites don't have an `apostrophe-images-pages` or `apostrophe-files-pages` module, those that do will experience no 404 errors due to Apostrophe's robust redirect features.
360* Apostrophe migrations are now more stable in MongoDB Atlas and other environments in which it is unwise to keep a single MongoDB cursor alive for long periods. To achieve greater stability, the `apos.migrations.eachDoc` method now fetches the `_id` properties of all relevant docs first, and they are then processed in small batches.
361* The `APOS_TRACE_DB=1` environment variable, which is useful for tracking down MongoDB issues, now includes traces for `distinct` calls.
362* A division-by-zero error in the migration progress display was fixed, correcting some strange-looking output.
363* In `apostrophe-assets`, the logic to determine the dev environment asset generation id was factored out to the `determineDevGeneration` method to simplify overriding it in `apostrophe-multisite`.
364* `apos.utils.post` and `apos.utils.get` now report HTTP errors (status >= 400) properly to their callbacks. The object provided as the error includes a `status` property with the HTTP status code. The body is still available in the second argument to the callback.
365
366## 2.94.1 (2019-08-12)
367
368* Bug fix for a regression that impacted the ability to edit an array field again after cancelling the first time. Thanks to Amin Shazrin for this contribution.
369
370## 2.94.0 (2019-08-09)
371
372* Bug fix for the new simplified static asset bundling: URLs beginning with `/` in CSS files are correctly rewritten to point to the bundle in the cloud when using the simple bundle feature (`APOS_BUNDLE=1`). This was already done for the old method.
373* In the browser, the lean methods `apos.utils.post` and `apos.utils.get` now accept non-JSON responses from APIs. To maximize bc, if the response has the `application/json` content type, it is always parsed for you; if not, it is still parsed for you if it is valid JSON, but otherwise it is delivered to you as-is (as a string).
374* When you edit the slug of a piece or page manually and a slug conflict with another piece or page is created, you can now optionally click a button in order to edit the conflicting piece or page, and change its slug to eliminate the conflict.
375
376## 2.93.0 (2019-07-25)
377
378* New, simplified static asset bundling feature for deploying to cloud hosts like Heroku. See the [ApostropheCMS Heroku HOWTO](https://docs.apostrophecms.org/apostrophe/tutorials/howtos/deploying-apostrophe-in-the-cloud-with-heroku) for details. There is more to successful Heroku deployment than just static assert bundling.
379
380First, make sure the `APOS_BUNDLE=1` environment variable is set in your production environment, i.e. in your Heroku environment settings.
381
382Next, set up a ["release tasks" script](https://devcenter.heroku.com/articles/release-phase):
383
384```
385# Remember, APOS_BUNDLE=1 must be set globally in your Heroku
386# environment settings already - not just this script but also
387# the regular dyno startup must see it
388
389node app apostrophe:generation
390node app apostrophe-migrations:migrate
391```
392
393And that's all you have to do! No more creating named bundles and committing them to git. That technique still works, but it is much more work for you.
394
395This new method does require that the release tasks script have access to the production database, as MongoDB is used to store the bundle until the Heroku dynos have a chance to unpack it locally.
396
397> Due to the temporary storage of the bundle in MongoDB, if your asset bundle is larger than 16MB this technique will not work... and your users will be miserable, waiting for a 16MB asset bundle to download on their phones! So please, just don't push that much code to the browser. If you must though, you can use the old technique.
398
399Again, see the [ApostropheCMS Heroku HOWTO](https://docs.apostrophecms.org/apostrophe/tutorials/howtos/deploying-apostrophe-in-the-cloud-with-heroku) for details. There is more to successful Heroku deployment than just static assert bundling, most importantly you need to use S3 for media storage.
400
401* In the lean library (`apos.utils.post`), use the csrf-fallback value for the csrf token if there is no csrf cookie name, same as the regular jquery library would. This achieves compatibility with the `disableAnonSessions: true` option of `apostrophe-express`.
402
403* When copying the permissions of a parent page to subpages, you now have the option to append them rather than replacing all existing permissions. Thanks to Siddharth Joshi.
404
405## 2.92.1 (2019-07-09)
406
407Unit tests passing.
408
409Regression tests passing.
410
411* Fixes for several bugs relating to tooltips persisting on the page longer than they should.
412* Fixes for three bugs relating to array fields: a `required` array field that is hidden by `showFields` is now correctly treated as not required (like other fields). Clicking "cancel" when editing an array now correctly reverts to the original contents of the array. And dynamic choice methods for `select` and `checkboxes` fields now work correctly when nested in an `array` or `object` field.
413* Nested areas can now be edited properly when found inside a dialog box, such as the "Edit" dialog box of a piece type.
414* Upgraded `diff` package to continue passing `npm audit`.
415* Upgraded `jQuery` from version 3.3.1 to version 3.4.1, for those who have set `jQuery: 3` as an option to `apostrophe-assets`. This addresses a minor prototype pollution bug in jQuery. Please note that if you are not using `jQuery: 3`, you are still using jQuery 1.x. If you have jQuery code that will not work with 3.x, you should take the plunge and fix it, as there are no new fixes forthcoming for any issues with jQuery 1.x. You can also use the new `lean: true` option to eliminate jQuery altogether when no user is logged in (in Apostrophe 3.x this will be the behavior all the time).
416
417## 2.92.0 (2019-06-26)
418
419Unit tests passing.
420
421Regression tests passing.
422
423* Bug fix: an open redirect vulnerability has been fixed. It was possible to convince Apostrophe to redirect to a third-party website by appending an escaped URL with a trailing slash added at the end. Apostrophe's trailing-slash remover would then cause a redirect to the un-escaped version of the slug part of the URL. The fix removes all multiple-slash sequences from the slug part of the URL. Thanks to Bharath for reporting this issue.
424* Bug fix: attempting to save a doc with a `required` `array` field without ever opening the array editor formerly caused strange behavior. You now get a standard indication that the field is required.
425* Feature: the method that supplies the choices for a dynamic `select` element may be a simple synchronous function, if desired. Formerly returning a promise (or using an async function) was mandatory.
426* Feature: `apos.utils.post` will now accept a `FormData` object as the `data` prameter. In this situation JSON encoding is not used. This may be used to easily submit file uploads with Apostrophe's CSRF protection and is supported at least back to IE11.
427
428## 2.91.1 (2019-06-05)
429
430Unit tests passing.
431
432Regression tests passing.
433
434* Bug fix: the `apos.utils.post` method introduced in version 2.90.0 now correctly submits the CSRF header.
435
436## 2.91.0 (2019-06-05)
437
438* Feature: it is much easier to write sites with **no jQuery, lodash, etc.** on the front end. The `apostrophe-lean-frontend` module has been deprecated and its functionality has been merged into the core. All of the functionality of the `apos.lean` object is now available on the `apos.utils` object at all times. And if you set the `lean: true` option for the `apostrophe-assets` module, **only lean JavaScript is pushed** when logged out (assets pushed with `when: 'lean'`, including the lean methods of `apos.utils`). This creates a migration path to a leaner frontend: developers can write NPM modules that rely only the lean `apos.utils` methods without worrying about whether they are present or not. Note that this is also the official frontend library for the forthcoming Apostrophe 3.x (Of course, as always, you can choose to push more code, use webpack, etc.)
439* Bug fix: a regression introduced in 2.90.0 caused all uses of "Copy Page" to copy the home page. This is fixed.
440* Bug fix: copying a page with custom fields now copies those fields properly.
441* Bug fix: "Copy Page" now correctly copies parked page fields to the new, unparked page and then allows them to be edited for the new page.
442* Bug fix: addressed browser errors that occurred when using an empty rich text toolbar. Unfortunately it is not possible to completely eliminate the ckeditor 4 toolbar when there are no tools present. This is due to a ckeditor bug.
443
444Thanks to Michelin for making much of this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
445
446## 2.90.0 (2019-05-23)
447
448Unit tests passing.
449
450Regression tests passing.
451
452* New feature: `select` schema fields now support dynamic choices. To use this feature, set `choices` to the name of a method of your module. Apostrophe will invoke that method on the fly to get the choices. Your method receives `(req)` and must return an array of choices. **Your method can be an `async` function, or return a promise for the choices array.** This means you can contact external APIs to obtain the choices. The choices array is in the same format as ever (objects with `label` and `value` properties). Note that if you just want to choose Apostrophe objects of various types, there is a better way: use `joinByOne` or `joinByArray` fields. Fields with dynamic choices do not support the `showFields` option.
453* New feature: `checkboxes` schema fields also support dynamic choices. The syntax is exactly the same as above. This allows multiple selection.
454* New feature: any `select` or `checkboxes` field in the schema of a widget can be moved to a compact select element that appears "in context" on the page, among the widget's controls. To do that, just set `widgetControls: true` in the schema field definition. If you wish, you can also set `contextual: true` so that the field no longer appears in the schema's editing dialog box. By default the field appears in both places. For space reasons, the interface for `checkboxes` is also powered by a select element, but you can add multiple choices by selecting the dropdown more than once. Each time you make a change via one of these fields, the widget is refreshed to show the impact of the change. **You may use dynamic choices as described above.**
455* New feature: the `viewsFolderFallback` option to `apostrophe-templates` may now be an array. Thanks to Amin Shazrin.
456* New feature: help has been added to the video widget explaining that what is needed is a URL to a YouTube or other oEmbed-friendly video.
457* New feature: you may now specify `htmlHelp` as a schema field option if you want to include simple markup, like links. The existing `help` option expects plaintext and escapes accordingly.
458* New feature: the `req` objects returned by `apos.tasks.getReq` and `apos.tasks.getAnonReq` now include a `session` object for broader compatibility with methods that expect a proper `req`. It is a plain object and does not remember anything beyond the lifetime of the `req`.
459* Bug fix: copying the "Home" page works properly.
460* Bug fix: the Apostrophe migrations progress meter no longer crashes if the operation reports more steps than the expected total.
461* Bug fix: watch all inlined stylesheets for changes, not just those implicitly inlined due to the use of the `css` extension when pushing them.
462* Bug fix: improved clearing of tooltips. Addresses various situations where a tooltip could linger on the screen.
463* Developer warnings: warning at startup if your module tries to use "extends" rather than "extend" to extend another module.
464* Developer warnings: warning at startup if your module attempts to "extend" `apostrophe-assets` or one of a few other core modules that are normally singletons, and probably should not ever have a competing instance under another name. Advice is given to write project level code for the module without `extend`, or to use `improve` when enhancing it via an npm module.
465
466## 2.89.1 (2019-05-13)
467
468Unit tests passing.
469
470Regression tests passing.
471
472* `getSchemaOptions` method no longer throws inappropriate errors when the alternate form of `apos.area` or `apos.singleton` is used. Bug introduced in 2.89.0.
473* The CSRF cookie is once again always reset on each request, to ensure no discrepancy between the session (and session cookie) lifespan and the CSRF cookie lifespan. This does not force sessions to exist unnecessarily, it just ensures CSRF errors do not mysteriously begin to appear in long-idle sessions, or when making cross-domain locale switches via the editing interface in apostrophe-workflow.
474* Edits to raw .css files once again trigger less-middleware to recognize a change has occurred and avoid sending a stale cached file in development. When `.css` (rather than `.less`) assets are pushed inline, which is necessary to match the behavior we formerly received from clean-css and avoid crashes on CSS that the LESS parser cannot handle, we now monitor them for changes ourselves and "touch" the master LESS file to help the `less-middleware` module figure out that they have been changed.
475
476Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support). Your organization can also take advantage of the opportunity to fund development of the features you would like to see as well as receiving fast, personal support from Apostrophe's core development team.
477
478## 2.89.0 (2019-05-01)
479
480Unit tests passing.
481
482Regression tests passing.
483
484* Many significant improvements to make crashes and restarts less likely.
485* The most frequently used methods now sanity-check their arguments and invoke their callback, or as appropriate, if they are not valid. This replaces many full-process crashes with polite 500 errors.
486* New, safer and easier alternatives to `self.route`:
487 * `self.apiRoute`, which accepts a `next` function that can be passed either an error, or `(null, value)`, where `value` is an object to be sent to the browser with a `status: 'ok'` property automatically added — the convention for APIs in Apostrophe 2.x. In addition, errors reported to `next` are converted to `status` properties and/or logged gracefully, including more complete information about where the error took place for easier debugging. Most core routes have been refactored to use it. This approach extends Express 4.0's concept of error handlers with the ability to handle success as well. You can still use `res` if you need to, for instance to issue a redirect.
488 * `self.renderRoute`, which accepts a `next` function that can be passed either an error that will be mapped to an appropriate HTTP status code, or `(null, { template: 'templateName', data: { ... props for the template ... })`. The named template is rendered with `self.render`, and any exceptions thrown are caught properly and logged as errors without a process crash — unlike what frequently happened before in such routes.
489 * `self.htmlRoute`, similar to renderRoute but it does not render the markup for you; instead you pass markup as the second argument to `next()`. Useful if you are rendering by some means other than `self.render`.
490* For template errors, a great deal of redundant error logging has been removed.
491* Introduced `apos.utils.warnDevOnce`, refactored some existing warnings to use it, and added a call for CSRF errors to help developers understand what these mean.
492* New trace feature to help debug crashes in Apostrophe's startup process. Try: `APOS_TRACE_STARTUP=1 node app`
493
494Thanks to Michelin for making this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support). Your organization can also take advantage of the opportunity to fund development of the features you would like to see as well as receiving fast, personal support from Apostrophe's core development team.
495
496## 2.88.1 (2019-04-25)
497
498Unit tests passing.
499
500Regression tests passing.
501
502* Fix: widgets are not lost when dragged to a different area.
503* Fix: widgets are not duplicated when dragged to a different area.
504* Fix: area save operations now use a lock to avoid lost information if several requests are made simultaneously for different areas, as can happen when dragging a widget between areas, which modifies both.
505* Fix: widgets can be edited again after being dragged, without a page refresh.
506* Fix: the "purple screen of death" error page now has a 500 status code, not 200.
507
508## 2.88.0 (2019-04-23)
509
510Unit tests passing.
511
512Regression tests passing.
513
514* An optional improvement to eliminate the use of session storage for most site visitors. By default, Apostrophe creates a session for every site visitor, even an anonymous visitor, to provide full CSRF protection. You may now optionally disable this for anonymous visitors:
515
516```javascript
517modules: {
518 'apostrophe-express': {
519 csrf: {
520 disableAnonSession: true
521 }
522 }
523}
524```
525
526When you do this, anonymous visitors receive only basic CSRF protection based on a known header value and the fact that the Same Origin Policy does not allow requests to be made by JavaScript unless the page is on the proper site.
527
528For performance reasons the largest sites will likely find this to be a valuable option.
529
530* `apos.global.findGlobal` now officially supports returning a promise. This was an unofficial side effect in earlier releases that ceased to work in recent releases.
531
532* Updated the version of `moment` that ships on the front end to the latest minor release.
533
534* Eliminated unnecessary arrangeFields warnings. `apostrophe-groups` is set up properly, the `trash` field no longer generates warnings when workflow is active, and reverse joins no longer generate warnings as they have no editing UI.
535
536* `null` values were able to crash the schema converters for strings, integers and floats when those fields were `required`. This has been fixed.
537
538## 2.87.0 (2019-04-10)
539
540Unit tests passing.
541
542Regression tests passing.
543
544* Tooltips have been added to improve the editor experience. For instance, tooltips appear on hover for the "up," "down," "clone" and "trash" buttons when working with areas.
545* Building on the performance work in version 2.86.0, all `ensureIndex` calls have been moved to the `migrate` startup phase and can thus be skipped with `APOS_NO_MIGRATE=1`. Note that as with the other recent changes, this means that if your site is *always* run with `APOS_NO_MIGRATE=1`, including at the time the database is created, it is imperative that you run `node app apostrophe-migrations:migrate` at least once. If your database starts out in a dev environment and is later moved to a production environment, or you use stagecoach or a similar deployment tool that guarantees migrations are run on all code deployments (and you should definitely do that), then this will not be an issue.
546* Building on the support for namespaced npm modules as apostrophe modules added in 2.86.0, the `testModule: true` flag used to test apostrophe in the context of an npm module like `apostrophe-workflow` can now be used in a namespaced npm module. Thanks to Aurélien Wolz for this contribution.
547
548Thanks to Michelin for making much of this work possible through [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
549
550## 2.86.0 (2019-04-03)
551
552Unit tests passing.
553
554Regression tests passing.
555
556* Apostrophe now supports namespaced NPM modules as apostrophe modules. This allows NPM private modules to be used to deliver, for instance, an apostrophe piece type, page type or widget type. Here is an example of valid configuration:
557
558```javascript
559require('apostrophe', {
560 modules: {
561 // ordinary npm module
562 'apostrophe-blog': {},
563 // namespaced npm module
564 '@somenamespace/somemodule': {}
565 }
566}
567```
568
569```javascript
570// in lib/modules/@somenamespace/somemodule/index.js
571module.exports = {
572 nifty: true
573};
574```
575
576* In addition, modules may be namespaced NPM-style inside a [bundle](https://docs.apostrophecms.org/apostrophe/other/more-modules#packaging-apostrophe-modules-together-creating-bundles). You will need to use a subdirectory structure, as seen above. As a best practice, you should only use this for module names you would have to publish to npm if the bundle feature did not exist. The "lead module" of the bundle should be in the same npm namespace.
577* If you are using the `partial` feature of `addColumn` with your pieces, you can now accept `piece` as a second argument. For bc, the value of that particular column property is still the first argument.
578* All of Apostrophe's "sanity-checking" database operations at startup, plus all Apostrophe migrations, now execute during a new `migrate` startup phase. This phase emits the `apostrophe:migrate` promise event. This phase occurs immediately after `afterInit` is invoked for modules, but before it is invoked for the global `afterInit` hook, if any. This change ensures there is a "sane" database before any interaction with the site takes place, and means that developers no longer have to remember to run `apostrophe-migrations:migrate` when upgrading during development.
579* You can also suppress these database operations at startup completely by setting the `APOS_NO_MIGRATE` environment variable to `1`, or by passing the `migrate: false` top-level option to Apostrophe. In this case, these operations all occur only when the `apostrophe-migrations:migrate` command line task is run. This option saves a great deal of startup time for the enterprise customers with the largest databases. Thus the best practice in production is the same as ever: run `node app apostrophe-migrations:migrate` before launching the new version of the app. In addition, you may set `APOS_NO_MIGRATE=1` in your production environment to save valuable startup time, especially during process restarts, etc.
580* Apostrophe now always instructs `less` to import CSS (not LESS) files `inline`. This is necessary because CleanCSS, which we no longer use, formerly automatically did it and without it import paths are incorrect. Thanks to Fredrik Ekelund for this fix.
581* UX improvement: if you edit a page, then follow a link from that page, and then click the "back" button, you should see your changes intact without the need to click "Refresh" thanks to the use of cachebusting headers. Thanks to Fredrik Ekelund for recommending an approach to the problem.
582* Bug fix: if your site startup or migration task invokes multiple time-consuming operations you'll now see a progress meter for each one, not just the first.
583* To save space and make sure developers don't just tune out, the warning about fields not properly arranged into tabs now appears at startup just for the first such module, unless you pass `--all-unarranged-fields` to get more information.
584
585Thanks to Michelin for making many of these features possible through [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
586
587## 2.85.0 (2019-03-27)
588
589Unit tests passing.
590
591Regression tests passing.
592
593* If a JPEG file has EXIF data such as the description, credit, etc. this information is
594now copied into new properties of the attachment field and made available automatically
595on corresponding new schema properties of `apostrophe-images` pieces.
596* `req.data.global` now becomes available even before its joins and area loaders are
597executed, as `req.aposGlobalCore`. This allows modules such as `apostrophe-pieces-orderings-bundle` to avoid recursive scenarios and performance problems.
598* Sortable columns in the manage view can now indicate whether the first click sorts forwards
599or backwards, simply by specifying the sort direction in the usual MongoDB way with `1` or
600`-1`.
601* Sortable columns can now be toggled from "no sort" to "forward" to "backward" and back to "no sort" again, and the hover state indicates all of these "next" states.
602* The `limitByAll` and `limitByTag` options of the `apostrophe-pieces-widgets` module now correctly remove these fields from the `showFields` of the select element that chooses how the widget will select content to display.
603* To select many consecutive pieces or pages quickly in the "Manage Pieces" and "Reorganize Pages" views, hold down the shift button while clicking a second piece. All pieces between the two pieces selected so far will be chosen.
604* Fixed a bug where removing an array item other than the last could cause a failure of the array field editor if the last array item were active. Thanks to anwarhussain93.
605
606## 2.84.1 (2019-03-25)
607
608* Documentation issue only. No code changes.
609
610## 2.84.0 (2019-03-25)
611
612Unit tests passing.
613
614Regression tests passing.
615
616* `npm audit` issue: `nunjucks`
617 * Created maintenance-only fork of `nunjucks` 2.x as `@apostrophecms/nunjucks`
618 * We will use Nunjucks 3.x in Apostrophe 3.x, this is a maintenance fork only
619 * Addressed dependency on old version of `chokidar` in `nunjucks` 2.x
620
621* `npm audit` issue: `clean-css`
622 * Verified this module offers no significant improvement in minification over the `compress` flag of `less`
623 * Removed this module from ApostropheCMS
624 * Verified CSS still minifies
625
626* You may now sort the "Manage Pieces" view by clicking on any column that has a `sort`
627property. By default `title` and `updatedAt` are now sortable. When using `addColumns`
628specify a `sort` property like:
629
630```javascript
631sort: {
632 title: 1
633}
634```
635
636For more information see [custom columns and sortable columns for the "manage pieces"
637modal](https://apostrophecms.org/docs/tutorials/getting-started/reusable-content-with-pieces.html#custom-columns-and-sortable-columns-for-the-quot-manage-quot-modal).
638
639* Fixed several situations formerly requiring a page refresh before editing. More
640such fixes to come. Thanks to `hexitex` for the bug reports and insight into the
641causes.
642
643* A recent change broke the display of the minimum image size to the user. This
644has been fixed.
645
646* A new warning has been added for failure to use `arrangeFields` comprehensively for
647all of your fields to make the "manage pieces" modal as clear as possible for the user.
648
649* Fixes were made allowing contextual editing of more types of content nested in `object` fields on the page. Thanks to bharathkumarc.
650
651Many thanks to Michelin for making much of this work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
652
653## 2.83.1 (2019-03-13)
654
655Unit tests passing.
656
657Regression tests passing.
658
659* Bug fix: a crash in the lock refresh route was possible if an advisory lock was taken away by another tab or user. Thanks to `hexitex` for the report and the solution.
660
661## 2.83.0 (2019-03-12)
662
663Unit tests passing.
664
665Regression tests passing.
666
667* When using the `apostrophe-pieces-import` module, you may now set the `importAsRichText: true` option on an `area` or `singleton` field to import markup rather than treating it as plaintext. With this setting in place the behavior matches `apostrophe-pieces-export`. Also note that both `apostrophe-pieces-import` and `apostrophe-pieces-export` have been updated to be more compatible with one another.
668
669## 2.82.0 (2019-03-08)
670
671Unit tests passing.
672
673Regression tests passing.
674
675* If the `APOS_ALWAYS_COPY_ASSETS` environment variable is set, always copy assets rather than symlinking them. This is useful when running under Docker. Thanks to hexitex for this contribution. See also [building Docker images for Apostrophe projects](https://apostrophecms.org/docs/tutorials/howtos/docker.html).
676
677## 2.81.2 (2019-03-06)
678
679Unit tests passing.
680
681Regression tests passing.
682
683* Stability improvement: search index method of the `tags` type will not crash if the `tags` type is somehow truthy without being an array.
684
685## 2.81.1 (2019-03-05)
686
687Unit tests passing.
688
689Regression tests passing.
690
691* Default values are now respected by the global doc. Specifically, if your field has a `def` property when the global doc is first created, it will be set accordingly. In addition, if a field is added to the schema and your site is restarted, it will also be added with the correct default at this time. Tests coverage has been added for this scenario.
692
693## 2.81.0 (2019-03-04)
694
695Unit tests passing.
696
697Regression tests passing.
698
699* The conflict resolution mechanism for simultaneous edits has been improved. Previously, Apostrophe tracked how long it had been since the "last edit" by the previous person. But if the browser window closed without sending an "unlock" message, that "last edit" might be a very long time ago. This led to nuisance confirmation prompts and a tendency to ignore their message.
700
701Beginning with this release, the browser instead actively refreshes the lock periodically. And if the browser does not do so for 5 minutes, the lock is automatically discarded.
702
703This greatly reduces the chance that you will see a "someone else is editing that document" message when this is not actually the case.
704
705However, do note that you will no longer see an indication of the "last edit" time. This is because this time was never really meaningful for the "Edit Piece" dialog box, and often misleading for on-page editing as well. Instead, you may assume that the other person is still at the very least on the page in question if you see this message at all.
706
707* Although it was released separately as part of the `launder` module, and an `npm update` should fetch it for you automatically, it should be mentioned that `launder` version 1.1.1 has been released and prevents crashes if the `value` of some of your select element choices is null or undefined. Such choices do not work and cannot be selected reliably (only strings and numbers are supported, including the empty string), but since versions prior to 1.1.0 did not crash on such choices, we have patched 1.1.1 to also tolerate their presence.
708
709Thanks to our [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support) clients for making these enhancements possible.
710
711* The case-insensitive sort for filter choices no longer crashes if a choice cannot be converted to a string. Thanks to Fawzi Fakhro.
712
713## 2.80.0 (2019-02-28)
714
715Unit tests passing.
716
717Regression tests passing.
718
719* A recently introduced change broke the filtering that prevented users from selecting too-small images when `minSize` is in effect. This has been corrected. Note that site visitors never actually saw too-small images because filtering did take effect later in the process.
720* Numbers (in addition to strings) are now permissible choices for select elements. If the choice selected is a number, a number will be stored in the field. Most of this fix is in the `launder` module but there is a small fix in apostrophe core as well.
721* If a doc is in the trash already, the edit dialog box should have a "Rescue" button rather than a "Trash" button on the "More" dropdown menu.
722* `boolean` fields can now be made `mandatory`. If a boolean field is mandatory, the form will not validate unless the user selects "Yes." This is useful for simple "terms and conditions" forms. You must specify a message to be shown to the user if they do not select "Yes," like this:
723
724```
725{
726 name: 'toc',
727 label: 'Accept the Terms and Conditions',
728 type: 'boolean',
729 // Displayed if you try to save without picking Yes
730 mandatory: 'You must accept the Terms and Conditions to continue.',
731 // Always displayed
732 help: 'I have read and accept the Terms and Conditions.'
733}
734```
735
736Although the documentation formerly claimed that `required: true` would have this effect for boolean fields, it was pointed out that this functionality did not work, and as a result far too many sites already use `required: true` for booleans in a way that would break if we implemented the original documented behavior. Therefore we are changing the documentation to match this new implementation that maintains backwards compatibility.
737
738## 2.79.0 (2019-02-22)
739
740Unit tests passing.
741
742Regression tests passing.
743
744* Built-in migration progress meter is much improved. The new implementation:
745 * Does not display anything if the task completes within 1 second;
746 * Allows work to begin even before the total number of items is known;
747 * Has a much more stable ETA;
748 * Does not crop the total off the far end;
749 * Displays steps/sec (very useful metric for development); and
750 * Has highly stable formatting (not distracting to the eye).
751* Eliminates unnecessary warnings about unconsumed promises in migrations.
752
753## 2.78.0 (2019-02-15)
754
755Unit tests passing.
756
757Regression tests passing.
758
759* You can now set permissions for many pieces at once via the new "set permissions for..."
760batch operation in the "manage pieces" dialog box. Batch operations are accessible via a
761dropdown at the bottom of the dialog box after you check the boxes to select various pieces.
762Note that if you check the box to select all the pieces on this page, you will be asked
763if you want to select *all* pieces. So it is possible to set the permissions of all of the
764pieces at once.
765
766Note that **permissions have no effect on file attachment URLs unless you use
767the optional [apostrophe-secure-attachments](https://github.com/apostrophecms/apostrophe-secure-attachments) module.** Once you add that module, the new batch operation becomes a powerful
768way to lock down all of your PDFs at once.
769
770* The "Select Everything" checkbox for pieces, which becomes accessible after you "Select All"
771pieces on the current page, now operates much faster on large databases and does not block
772the main thread of browser execution for an extended time.
773
774Thanks to our [enterprise clients](https://apostrophecms.org/support/enterprise-support),
775including Michelin, for their support of our work on these items.
776
777## 2.77.2 (2019-02-12)
778
779Unit tests passing.
780
781Regression tests passing (including new migrations test).
782
783* Most migrations were failing when run in a non-interactive session.
784This was due to a stray piece of code that tried to interact with the
785progress meter when it was not available. This has been fixed. This
786was the underlying major issue in version 2.77.0.
787* The recent migration to set the `docIds` and `trashDocIds` properties of
788attachments correctly, allowing them to become inaccessible at the
789proper time, now runs and completes correctly, at the end of which
790all attachment permissions are properly restored. This resolves the issue
791that began with version 2.77.0.
792* The migration was also updated to avoid any chance of needlessly
793disabling permissions on a temporary basis during the migration run.
794* **If you temporarily lost access to your media due to running migrations
795with 2.77.0, which was available for a few hours today, you can restore access**
796with the following command line task:
797
798```
799node app apostrophe-attachments:recompute-all-doc-references
800```
801
802**If you manually set your permissions globally as a workaround**, you should run
803this task to reset them appropriately:
804
805```
806node app apostrophe-attachments:reset-uploadfs-permissions
807```
808
809Although there is no reason to expect a recurrence of this issue, these
810command line tasks will continue to be available going forward, just in case.
811
812### Regression test updates
813
814Our regression tests are being updated to prevent a recurrence by
815noninteractively invoking `apostrophe-migrations:migrate`
816and checking for a clean exit code.
817
818## 2.77.1 (2019-02-12)
819
820Unit tests passing.
821
822Regression tests passing.
823
824* Unfortunately the new migration in 2.77.0 appears to have caused
825all permissions to revert to 000 on uploaded media on at least one site.
826In an abundance of caution we have pushed out 2.77.1 which does not
827carry out that migration. We are working on 2.77.2 which will carry it out
828properly. You may restore your permissions with
829`chmod 644 public/uploads/attachments/*`, if you are using S3 you
830can do this by restoring public access to each file, for Azure the
831suffix added to the name to disable each file would need to be removed.
832Fortunately this issue was caught quickly so there are probably no
833instances of the latter two in the wild.
834
835We apologize for this serious issue and will provide a complete postmortem
836with 2.77.2.
837
838## 2.77.0 (2019-02-12)
839
840* **The home page now works correctly when it is a pieces-page** powered by
841`apostrophe-pieces-pages`. Specifically, the URLs of pieces are generated
842correctly in this situation. This allows the home page to be a blog page,
843for example. Regression tests have been added to ensure this does
844not break in the future.
845
846* **Attachments (files) now become inaccessible properly** when the
847last file or image piece that directly contains them moves to the trash.
848Formerly, attachments were incorrectly marked as "part of" pages that
849merely loaded them as part of a join or similar relationship. **A migration
850has been added** to correctly reset the `docIds` and `trashDocIds` arrays
851of all attachments on a one-time basis after which they will be tracked
852properly going forward.
853
854* **Migrations now have a progress display when iterating over all
855documents.** This progress display automatically goes away if the
856migrations task is not running with access to a TTY (for instance,
857it is running in a deployment pipeline). You may note that not all
858migrations use this feature; generally the most time-consuming will however.
859
860* **You can now specify a projection for a reverse join without the need to explicitly include the `idsField`, or even know what it is.** This was one of several reasons why developers often gave up on projections for reverse joins, or went back to the old approach of specifying `idsField` rather than using `reverseOf`.
861
862Here is an example from the [apostrophe-samples](https://github.com/apostrophecms/apostrophe-samples) project:
863
864```javascript
865// Forward join: in schema of products
866{
867 name: '_specialists',
868 type: 'joinByArray',
869 withType: 'specialist',
870 label: 'Specialists',
871 help: 'The right people to ask about this product.'
872}
873```
874
875```javascript
876// Reverse join: in schema of specialists
877{
878 name: '_products',
879 type: 'joinByArrayReverse',
880 withType: 'product',
881 reverseOf: '_specialists',
882 projection: {
883 _url: 1,
884 title: 1
885 }
886}
887```
888
889> Note that we can also project `_url: 1` to get all the fields necessary
890to populate `_url` when the product is fetched, even though it is not
891a real property in the database.
892
893* Unnecessary schema validation errors are no longer thrown when using
894`joinByOneReverse` with `reverseOf`.
895
896* Schema fields named `format` are now allowed for pieces. There was a
897conflict with the UI code and backend routes of the "Manage Pieces" dialog box.
898
899* "Drag and drop" now works properly for widgets that have just been
900added to the page. There is no need to refresh the page first.
901
902## 2.76.1 (2019-02-06)
903
904Unit tests passing.
905
906Regression tests passing.
907
908* Removed unneeded call to `self.apos.utils.readOnlySession` in `apos.notify`, preventing crashes when this is invoked from a command line task. This fixes `apostrophe-favicons`.
909* Also updated `self.apos.utils.readOnlySession` so it will gracefully ignore calls made with no session in `req` (typically command line tasks).
910* Eliminated uses of `async/await` in core unit tests. This module still supports Node 6.x, so we use promises directly, not via async/await, in core code; of course you can still `await` most of our APIs in your own projects, because `await` works with anything that returns a promise.
911* Fixed a bug that prevented page permissions from propagating properly when "Apply to Subpages" is checked in "Page Settings." Thanks to Mayank Bansal. Unit tests were also added to prevent a regression in the future.
912* A bug that prevented the home page type from being changed via the UI in certain situations has been fixed.
913
914## 2.76.0 (2019-02-01)
915
916Unit tests passing.
917
918Regression tests passing.
919
920* Email schema field type added. Thanks to Andrea Di Mario.
921* Developer warnings for bad `showFields` configuration now apply to all field types that support `showFields`.
922* Schemas are now validated for nested `array` and `object` schemas, giving developers more information to help them fix their code.
923* The `poll-notifications` API now runs as middleware that is scheduled as early as `req.user` becomes available, avoiding the overhead of loading `req.data.global` in this frequently polled API.
924* The `poll-notifications` API does not crash if the `apos` object has been destroyed. This is not an issue for typical sites. However, this fix removes scary error messages displayed by the very useful [apostrophe-monitor](https://github.com/apostrophecms/apostrophe-monitor) module, which is similar to `nodemon` but specialized to Apostrophe for much faster restarts.
925* Although technically released in the `moog-require` module, not here, a recent fix in that module bears mentioning because it prevents both `apostrophe-monitor` and `apostrophe-multisite` from misbehaving when the options objects of modules are modified. Specifically, the modifications are now reliably distinct for each `apos` object.
926*
927* The logic that removes certain typically unwanted buttons from CKEditor is now conditional and does not remove them when they are explicitly requested in the toolbar. Thanks to Fredrik Ekelund.
928* Placeholder markup when a pieces widget is empty. Although not often used directly, this template is often copied as a starting point.
929* An open "add widget" area menu now appears above any hovered widget controls rather than being lost behind them.
930* `showFields` support for fields of type `checkboxes` has been restored.
931* The "recursion warning" that appears when the same doc is loaded more than 5 times in a single request can now be suppressed on a per-request basis by setting `req.suppressAreaLoaderRecursionWarnings` to `true`. However the runaway loading process is still prevented. This is mainly of use for workflow API routes that examine many documents but are OK with stopping in this situation without generating extra log messages.
932
933Thanks to Michelin for sponsoring much of this work through [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
934
935## 2.75.1 (2019-01-24)
936
937Unit tests passing.
938
939Regression tests passing.
940
941* If a user has the type-specific `admin-product` permission, they should always be able to view a `product`, no matter whether it is published or not. This logic was correct for editing but not for viewing. Fixed a bug that led to crashes with the workflow module in this scenario.
942
943Thanks to Michelin for making this fix possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
944
945## 2.75.0 (2019-01-15)
946
947Unit tests passing.
948
949Regression tests passing.
950
951* An "Undo" button has been added for the "Remove Widget" feature. Although such changes can be undone via "Page Versions," that feature is advanced and somewhat hard to find, whereas this simple "Undo" button is immediately helpful to most users.
952* Apostrophe now displays warnings for several common developer errors. Previously it was difficult to understand why a module didn't work if `extend` was missing for certain common cases, like a `-widgets` or `-pieces-pages` subclass module. We will expand these warnings over time; options are provided to disable them if they do not apply to your situation.
953* The server side notification persistence feature introduced in version 2.74.0 led to an intermittent bug: the "long polling" used to deliver notifications quickly interacted badly with the "resave" behavior of Express sessions, resulting in frequent loss of other session changes, such as draft/live mode switching. This has been fixed. Since we cannot disable `resave` with the standard session store in Apostrophe 2.x, an `apos.utils.readOnlySession(req)` method was added, and the route that "long polls" for new notifications now uses it to disable any modification to the session for the duration of the request.
954* `limitByAll`, `limitByTag` and `limitById` options for `apostrophe-pieces-widgets`. When set the user is not prompted to choose their own maximum.
955* Fixed conditions in which editing the first or last name of a new `apostrophe-user` did not affect their `slug` in the expected way.
956* Fixed bug: if trashInSchema is in effect, subpages should not have their trash status overridden to match the new parent when their ancestor is moved. This is important when using "Reorganize" with workflow. Additional improvements to better integrate "Reorganize" into the workflow module are separately forthcoming.
957* Fixed a bug that prevented `view` permissions from being given out programmatically in certain edge cases.
958* The `slug` cursor filter now has a `launder` method, for use when marking it safe for `req.query`. Thanks to Anthony Tarlao.
959
960Thanks to our customers at Michelin and NPM for making much of the above work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
961
962## 2.74.0 (2018-12-13)
963
964Unit tests passing.
965
966Manual regression tests passing.
967
968* 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.
969
970You 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:
971
972```
973apos.notify(req, 'Sorry, you did not win a shiny new %s!', req.piece.title, { type: 'error' });
974```
975
976The 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.
977
978* 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.
979
980* 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.
981
982* 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.
983
984* When `apostrophe-workflow` is present, "Batch Commit" and other inappropriate options are no longer offered for groups, which are not subject to workflow.
985
986Thanks to Michelin for making much of the above work possible via [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
987
988## 2.73.0 (2018-12-06)
989
990Unit tests passing.
991
992Regression tests passing.
993
994* Added in-context editing support, support for the `contextual` flag, and `skipInitialModal` support for areas and singletons nested in fields of type `object`. Many thanks to Michelin for making this feature possible through their participation in [Apostrophe Enterprise Support](https://apostrophecms.org/support/enterprise-support).
995* The `date` Nunjucks filter now accepts `locale` as a second argument. If `locale` is not present and `req.locale` is set, that locale is used, rather than the default system locale. Thanks to Tim Otlik.
996* Removed nuisance warnings about tolerant sanitization.
997* When using the `passwordReset: true` feature of `apostrophe-login`, you may also set the `passwordResetSubject` option to a custom subject line for the password reset email message.
998* The mechanism that sends the password reset request confirmation email has been factored out to the `apos.login.sendPasswordResetEmail(req, user)` method, so you can trigger it for your own reasons. This method returns a promise; when that promise resolves the password reset email has been successfully handed off for delivery. Note that the promise will be rejected if the user object has no `email` property.
999
1000## 2.72.3 (2018-12-03)
1001
1002Unit tests passing.
1003
1004Regression tests passing.
1005
1006* The "apply to subpages" feature for page permissions has been greatly simplified and made easier to understand. There is now just one shared "copy these permissions to subpages now?" dropdown, which applies to ALL current permissions for the current page: "who can view this page," "these users can view," "these groups can edit," etc.
1007
1008As the help text now properly explains, if you pick "yes" and save page settings as usual, the permissions of all subpages are updated to match **on a one-time basis.** After that, you can edit them normally for the subpages. This is an action that takes place at "save" time, it is not a setting that is remembered.
1009
1010This is good for laying down a baseline and then making fine-tuned adjustments per page, which is typical practice.
1011
1012Previously this choice appeared in several places, including as a highly confusing and visually cluttered dropdown within the list of permissions per user and group. While theoretically this allowed for propagating fine-tuned adjustments to subpages one at a time, in practice users did not understand it, including many enterprise customers who invest significant time in Apostrophe. Therefore a simpler solution is of greater overall value.
1013
1014* Regression fix: support for in-context, on-page editing of areas in array fields has been restored.
1015
1016* Attempts to save a field of type `object` with a missing `required` field now behave sensibly, you no longer see a spinner forever on a grayed-out page. Note that the use of `required` for the object itself has no meaning because there is always an object; you should make its fields required, or not, as you see fit.
1017
1018* "Move" and "Trash" operations on widgets now emit the Apostrophe events `widgetMoved` and `widgetTrashed`. The widget's container div is emitted as the argument to the event.
1019
1020## 2.72.2 (2018-11-28)
1021
1022Unit tests passing.
1023
1024Regression tests passing.
1025
1026* The `apostrophe-jobs` `runNonBatch` method no longer crashes if the job-runner function provided does not return an object (for instance, because it takes a callback so its return value does not matter).
1027* `apostrophe-attachments:list` task lists the URLs of all valid attachments, including all crops in all sizes.
1028* `array` fields may be used in the `relationship` of a join. Thanks to Anthony Tarlao.
1029* Added missing callback to asset bundle cleanup for cloud deployments, ensuring that the lock is eventually released and the old bundles are eventually removed.
1030* Fixed documentation for `apos.jobs` methods re: the `labels` option.
1031
1032## 2.72.1 (2018-11-07)
1033
1034Unit tests passing.
1035
1036Regression tests passing.
1037
1038* Moving a page beneath a parent that happens to be considered "not trash" should not automatically cause the child to be considered "not trash" when workflow is in effect, or when the `trashInSchema` flag has been opted into for `apostrophe-docs`. In these cases the trash flag is just another schema property. This bug led to pages inadvertently becoming live across all locales when moved in the page tree.
1039* The server-side video schema field converter no longer crashes the process if given a `null` property, and correctly flags the field as in error if it is `required` and not present.
1040* Any missing values for join relationships relating to permissions are now handled in a proper migration in apostrophe core, rather than a hack in apostrophe-workflow that adds significant startup time in certain situations.
1041* Migration completion is now logged.
1042* UX fix: UI/area controls no longer compete with "Add Content."
1043
1044Thanks to our enterprise support customers for their support of this work.
1045
1046## 2.72.0 (2018-10-30)
1047
1048Unit tests passing.
1049
1050Regression tests passing.
1051
1052* Support for subdirectories of `lib/modules`. You must set the `nestedModuleSubdirs` option to `true` in `app.js`. You can then place your modules in nested subdirectories of `lib/modules`. **The names of the parent folders do not matter,** and **the name of the actual module folder must still match the name of the module.**
1053
1054In addition, when using this feature you may optionally move part of your `modules` configuration into a `modules.js` file in each directory. Here is an example:
1055
1056```javascript
1057module.exports = {
1058 'module-name': {},
1059 'other-module-name': {}
1060};
1061```
1062
1063By following through with this approach you can make `app.js` much shorter. Configuration of Apostrophe modules installed via `npm` must still be done in `app.js`.
1064
1065* The `apostrophe-html-widgets` module now properly concatenates fields to the standard HTML field when `addFields` is used with it.
1066
1067* Fixed a crashing bug when an API was used in an atypical way. Thanks to Max Schlueter.
1068
1069## 2.71.1 (2018-10-24)
1070
1071Unit tests passing.
1072
1073Regression tests passing.
1074
1075Recent changes to the markup for buttons broke drag and drop for widgets. This has been fixed.
1076
1077## 2.71.0 (2018-10-23)
1078
1079Unit tests passing.
1080
1081Regression tests passing.
1082
1083* When two pieces or pages would have the same slug as the result of an insert or update, Apostrophe automatically appends a unique string. This makes sense for data integrity but as a user experience it leaves something to be desired.
1084
1085Beginning with this release, if you are editing the title in the piece or page settings editor and apostrophe is making automatic slug suggestions, these suggestions will *now include the suffix* needed to avoid a conflict. This gives you a chance to see what will happen, and decide to change the title or the slug in a better way. However, you can disable this by setting the `deconflictSlugs` option of the `apostrophe-docs` module explicitly to `false`. If you do, then from now on you will *receive a straightforward error message if the suggested slug is in conflict with another slug on the site.*
1086
1087* If you edit the slug directly and try to save it with a conflict, Apostrophe will always report a straightforward error in the editor, requiring you to fix it manually. This makes sense when you are editing the slug yourself, because it means you care about the exact value.
1088
1089For backwards compatibility and to resolve race conditions, the server will still automatically modify the slug to be unique in the rare event that a conflict arises during the save operation itself.
1090
1091* A simpler yet even better slug prevention feature, in many ways: all `apostrophe-pieces` modules now accept a `slugPrefix` option. For instance, if you set this option to `people-` for your `people` module and to `image-` for the `apostrophe-images` module, the slugs for your people and the photos of them you are uploading will never be in conflict.
1092
1093We appreciate our enterprise customers and their support of this work.
1094
1095## 2.70.1 (2018-10-18)
1096
1097Unit tests passing.
1098
1099Regression tests passing.
1100
1101* Bug fix: when you attempt to edit a piece that someone else has open in the edit dialog box, you should receive a warning, and the option to take over or leave it alone. This worked, however the "advisory lock" was not released when *closing* the dialog box. So users saw superfluous warnings. The bug was related to calling `$.jsonCall` with the wrong order of arguments.
1102* Bug fix: a user without permissions to lock a particular document could cause a process restart by attempting to lock it. No inappropriate access was granted.
1103* When configuring the `csrf` option of `apostrophe-express`, you may now pass the `cookie` subproperty in order to pass configuration options to `res.cookie`, such as `secure: true`.
1104* The jQuery `onSafe` plugin now respects the return value of the event handler, allowing the use of `return false;` in such handlers. Thanks to Fredrik Ekelund.
1105* The Apostrophe `button` macro now renders a `button` rather than an anchor tag, except when the `url` option is present. Thanks to Fredrik Ekelund.
1106
1107## 2.70.0 (2018-10-08)
1108
1109Unit tests passing.
1110
1111Regression tests passing.
1112
1113Apostrophe now allows direct import of unparsed CSS files via import flags of LESS. The best use of this option is to push a CSS file created by a SASS compiler or other LESS alternative.
1114
1115To push a CSS asset *without* compiling it as LESS, you may write:
1116
1117```
1118self.pushAsset('stylesheet', {
1119 name: 'bundle',
1120 import: {
1121 inline: true
1122 }
1123});
1124```
1125
1126Or, if you are pushing assets via the `stylesheets` option of the `apostrophe-assets` module, you may write:
1127
1128```
1129'apostrophe-assets': {
1130 stylesheets: [
1131 {
1132 name: 'bundle',
1133 import: {
1134 inline: true
1135 }
1136 }
1137 ]
1138}
1139```
1140
1141The extension of the file may be either `.css` or `.less`; either way it is imported with no LESS compilation. Apostrophe will still modify URLs to accommodate the global `prefix` option, if present.
1142
1143## 2.69.1 (2018-10-04)
1144
1145Unit tests passing.
1146
1147Regression tests passing.
1148
1149* In-context editing of areas nested in arrays now works correctly when the widget containing the array has just been added to the page for the first time.
1150
1151## 2.69.0 (2018-10-03)
1152
1153Unit tests passing.
1154
1155Regression tests passing.
1156
1157* Promisified all of the apis for migrations, including the option of iterators that return promises, and implemented migrations for old piece and page slugs that have not been deduplicated and thus can block new pages or pieces from taking a slug even though we have logic for this for new pages and pieces.
1158* In-context editing support for areas and singletons that are schema fields of arrays. Leaves other, noncontextual data alone. Creating and editing entire array items contextually is outside the scope of this change; use an area rather than an array for that. Directly nested arrays are not supported, but you may use an area in an array in a widget in an array, etc.
1159* `.jpeg` files were slipping through with that extension. All new uploads will be correctly converted to `.jpg` and go through the proper sizing process.
1160* The `enableShowFields` option was missing some of its logic for fields of type `checkboxes`. Thanks to Anthony Tarlao.
1161* A `_title` property is now included in attachments returned by `apos.images.all` and `apos.images.first`.
1162* When apostrophe cannot fix a unique key error, it is helpful to be able to see the last error, as well as the original one. This helps you figure it out if both a unique slug error and an unrelated unique key error are part of the puzzle. We still throw the original error, but we also attach the last error as a property of it, so you can see both.
1163* The `apos.areas.fromPlaintext` method now takes an `options` parameter. You may set the `el` property to an element name, in which case the markup is wrapped in that HTML element. `options` may be omitted.
1164
1165## 2.68.1 (2018-09-27)
1166
1167Unit tests passing.
1168
1169Regression tests passing.
1170
1171* When we introduced allowedSubpageTypes and allowedHomepageTypes in 2.67.0, we broke support for different schemas in different page types. Those regressions are fixed here.
1172* The default page type choice offered for a new page is the first type permitted by its parent page.
1173
1174## 2.68.0 (2018-09-26)
1175
1176Unit tests passing.
1177
1178Regression tests passing.
1179
1180* The `lateCriteria` cursor filter now works properly, allowing special mongodb criteria that are not allowed inside `$and` to be merged into the criteria object at the last minute.
1181* A noisy warning produced on every page send by the latest version of Bluebird has been silenced.
1182* Performance: explicitly shut off `sort()` for certain cases where we know only one document will be returned. This allows MongoDB to select a more efficient index more often.
1183* `nlbr` Nunjucks filter no longer results in double-escaped markup. Thanks to Ulf Seltmann.
1184* The `apostrophe-global` module now supports the `separateWhileBusyMiddleware` option. Iby separate middleware that checks for the lock flag in apostrophe-global even if the regular middleware of this method has been disabled and/or overridden to cache in such a way as to make it unsuitable for this purpose. For normal use this option is not necessary.
1185* Fixes made to further reduce conflicts between sites with `apostrophe-multisite`. For instance, the `apostrophe-workflow` module no longer breaks the dashboard.
1186* The home page can now be copied. If you copy the home page, you get a new child of the home page with the same content. Thanks to Tim Otlik.
1187
1188## 2.67.0 (2018-09-14)
1189
1190Unit tests passing.
1191
1192Regression tests passing.
1193
1194* Pages can now be locked down with the `allowedHomepageTypes` and `allowedSubpageTypes` options, like this:
1195
1196```javascript
1197// Only one type allowed for the home page
1198allowedHomepageTypes: [ 'home' ],
1199
1200allowedSubpageTypes: {
1201 // Two subpage types allowed for the home page
1202 'home': [ 'default', 'apostrophe-blog-page' ],
1203 // No subpages for the blog page ("show pages" don't count)
1204 'apostrophe-blog-page': [],
1205 // default page type can only have another default page as a subpage
1206 'default': [ 'default' ]
1207}
1208```
1209
1210These options make it easy to prevent users from creating unintended scenarios, like nesting pages too deeply for your navigation design.
1211
1212* Pages now support batch operations, just like pieces do. The initial set includes trash, rescue, publish, unpublish, tag and untag. You can only rescue pages in this way if you are using the `trashInSchema` option of the docs module, which is always the case with `apostrophe-workflow`. With the conventional trash can, it is unclear what should happen because you have not indicated where you want each page to be restored. New batch operations for pages can be added in the same way that they are added for pieces.
1213
1214* Important performance fix needed for those using the `apostrophe-pieces-orderings-bundle` module to create custom sort orders for pieces. Without this fix it is also possible to get a loader error and stop fetching content prematurely.
1215
1216* The "revert" button for versions is now labeled "Revert to" to emphasize that it reverts to what you had at the end of that operation, not its beginning. Thanks to Fredrik Ekelund.
1217
1218## 2.66.0 (2018-09-07)
1219
1220* Updated to CKEditor version 4.10.0. The CKEditor build now includes the CKEditor "widgets" feature (not to be confused with Apostrophe widgets). These are essential for modules like the forthcoming `apostrophe-rich-text-merge-tags`.
1221* `apos.areas.richText` and `apos.areas.plaintext` no longer produce duplicate text. To achieve this, the `apos.docs.walk` method no longer walks through the `_originalWidgets` property. This property is only used to preserve the previous versions of widgets that the user lacks permission to edit due to schema field permissions. Exploration of this property by `apos.docs.walk` led to the observed bug.
1222* The browser-side implementation of `apos.utils.escapeHtml` now works properly.
1223
1224## 2.65.0 (2018-09-04)
1225
1226Unit tests passing.
1227
1228Regression tests passing.
1229
1230* **Important fix for MongoDB replica sets:** previously we used the `autoReconnect` option of the MongoDB driver by default. From now on, we use it only if the MongoDB URI does not refer to a replica set. The use of `autoReconnect` is [inappropriate with a replica set](https://github.com/apostrophecms/apostrophe/issues/1508) because it will keep trying to connect to the node that went down. Leaving this option out results in automatic use of nodes that are up. Also see the [apostrophe-db-mongo-3-driver](https://npmjs.org/package/apostrophe-db-mongo-3-driver) module for a way to use the newer `mongodb+srv` URIs. Thanks to Matt Broadstone of MongoDB for his advice.
1231
1232* An `apostrophe-file` now has a default URL. The default `_url` property of an `apostrophe-file` piece is simply the URL of the file itself. This allows `apostrophe-file` to be included in your configuration for [apostrophe-permalinks](https://npmjs.org/package/apostrophe-permalinks); picking a PDF in this way generates a direct link to the PDF, which is what the user expects. Note that if the developer elects to set up an `apostrophe-files-pages` module that extends `apostrophe-pieces-pages`, that will still take precedence, so there is no bc break.
1233
1234* Clicking directly from one rich text widget into another did not work properly; the toolbar did not appear in this situation. This bug has been fixed. The bug only occurred when clicking in a second rich text widget without any intervening clicks outside of all rich text widgets.
1235
1236* Also see expanded notes on version `2.64.1`, below, which contained several features missed in the original changelog.
1237
1238## 2.64.1 (2018-08-31)
1239
1240Unit tests passing.
1241
1242Regression tests passing.
1243
1244* Improved Apostrophe's ability to redisplay the appropriate widget, array element, and field and call the user's attention to it when a schema field error is not detected until server-side validation takes place. This addresses problems that come up when fields become `required` at a later time, and/or data was originally created with an earlier release of Apostrophe that did not enforce `required` in all situations. Browser-side validation is still preferred for ease of use but server-side validation no longer creates situations the user cannot easily resolve.
1245
1246* Introduced the `apos.global.whileBusy` method. This method accepts a function to be run *while no one is permitted to access the site.* The provided function may return a promise, and that promise resolves before the site becomes accessible again. In the presence of `apostrophe-workflow` it is possible to mark only one locale as busy.
1247
1248* By default, the `apos.locks.lock` method waits until the lock is available before proceeding. However there is now a `wait` option which can be set to `false` to avoid waiting at all, or to any number of milliseconds. If the method fails because of `wait`, the error is the string `locked`.
1249
1250* The `apos.locks.lock` method also now accepts a `waitForSelf` option. By default, if the same process invokes `apos.locks.lock` for the same lock in two requests simultaneously, one of the two will receive an error. With `waitForSelf`, the second invocation will wait for the first to resolve and then obtain the lock.
1251
1252## 2.64.0 (2018-08-29)
1253
1254Unit tests passing.
1255
1256Regression tests passing.
1257
1258* Apostrophe's "search suggestions" feature for `notFound.html` templates is now fully baked. It only takes two steps:
1259
12601. Include an element like this in your `notFound.html` template:
1261
1262```
1263<div data-apos-notfound-search-results></div>
1264```
1265
12662. Set the `suggestions` option to `true` for the `apostrophe-search` module.
1267
1268With `suggestions: true`, this feature no longer requires that you have a `/search` page, it uses a dedicated route. See the documentation of the `apostrophe-search` module for more information.
1269
1270* The `showFields` option is now available for checkboxes. The syntax is as follows:
1271
1272```
1273{
1274 "name": "awesomeBoolean",
1275 "label": "Awesome Boolean",
1276 "type": "boolean",
1277 "choices": [
1278 {
1279 "value": true,
1280 "showFields": ["otherField1"]
1281 },
1282 {
1283 "value": false,
1284 "showFields": ["otherField2"]
1285 }
1286 ]
1287}
1288```
1289
1290Thanks to falkodev.
1291
1292* A useful error message appears if you try to use a `mongodb+srv` URL. These are meant for newer versions of the MongoDB driver. You **can** use them, but you must install the [apostrophe-db-mongo-3-driver](https://npmjs.com/package/apostrophe-db-mongo-3-driver) module first. The error message now explains this, addressing a common question on stackoverflow.
1293* Basic styles added for the most common rich text markup tags when within the bounds of an Apostrophe modal. Thanks to Lars Houmark.
1294* Fixed UI overlap issue when joining with `apostrophe-page`.
1295* `apos.images.all`, `apos.images.first`, etc. now include `_description`, `_credit` and `_creditUrl` when they can be inferred from an `apostrophe-image` containing the attachment.
1296* `apos.images.srcset` helper improved. It is now smart enough to limit the image sizes it offers based on what it knows about the size of the original. Thanks to Fredrik Ekelund.
1297* Fixes to CSS asset URL generation to pass validation.
1298* Performance: eliminated use of `$or` MongoDB queries with regard to pages in the trash. MongoDB tests demonstrate that `$ne: true` is faster than `$or` for our purposes.
1299
1300## 2.63.0 (2018-08-15)
1301
1302Unit tests passing.
1303
1304Regression tests passing.
1305
1306* “Promise events” have arrived. This is a major feature. Promise events will completely
1307replace `callAll` in Apostrophe 3.x. For 2.x, all existing invocations of `callAll` in the
1308core Apostrophe module now also emit a promise event. For instance, when the `docBeforeInsert`
1309callAll method is invoked, Apostrophe also emits the `beforeInsert` promise event on the
1310apostrophe-docs` module.
1311
1312Other modules may listen for this event by writing code like this:
1313
1314```javascript
1315`self.on('apostrophe-docs:beforeInsert', 'chooseASpecialist', function(req, doc, options) {
1316 // Modify `doc` here. You may return a promise, and it will resolve before
1317 // any more handlers run. Then the doc is inserted
1318});
1319```
1320
1321The above code adds a new `chooseASpecialist` method to your module. This way, the method can be overridden by assigning a new function to `self.chooseASpecialist` in a module that
1322extends it, or its behavior can be extended in the usual way following the `super` pattern.
1323
1324But, since it does not have the same name as
1325the event (attempting to register a method of the same name will throw an error), it is unlikely
1326that parent class modules and subclass modules will have unintentional conflicts.
1327
1328See the [original github issue](https://github.com/apostrophecms/apostrophe/issues/1415) for a more
1329complete description of the feature and the reasoning behind it.
1330
1331**Your existing callAll methods will still work.** But, we recommend you start migrating to be
1332ready to move to 3.x in the future... and because returning promises is just a heck of
1333a lot nicer. You will have fewer problems.
1334
1335* Optional SVG support for `apostrophe-attachments`. To enable it, set the `svgImages` option to
1336`true` when configuring the `apostrophe-attachments` module. SVG files can be uploaded just like
1337other image types. Manual cropping is not available. However, since most SVG files play very well
1338with backgrounds, the SVG file is displayed in its entirety without distortion at the largest size
1339that fits within the aspect ratio of the widget in question, if any (`background-size: contain`
1340is used). If you have overridden `widget.html` for `apostrophe-images-widgets`, you will want
1341to refer to the latest version of `widgetBase.html` for the technique we used here to ensure
1342SVG files do not break the slideshow’s overall height.
1343* New `apos.templates.prepend` and `apos.templates.append` methods. Call
1344`apos.templates.prepend('head', function(req) { ... })` to register a function to be called just after
1345the head tag is opened each time a page is rendered. The output of your function is inserted into
1346the markup. The standard named locations are `head`, `body`, `contextMenu` and `main`. This is
1347convenient when writing modules that add new features to Apostrophe. For project level work also see the
1348named Nunjucks blocks already provided in `outerLayoutBase.html`.
1349* `apos.singleton` now accepts an `areaOptions` option, which can receive any option that can be
1350passed to `apos.area`. Thanks to Manoj Krishnan.
1351* Apostrophe’s “projector” jQuery plugin now respects the `outerHeight` of the tallest slideshow item,
1352not just the inner height.
1353* `apos.area` now accepts an `addLabel` option for each widget type in the area. Thanks to
1354Fredrik Ekelund.
1355* UI improvements to versioning. Thanks to Lars Houmark.
1356* Button to revert to the current version has been replaced with a label indicating it is current,
1357since reverting to the current version has no effect.
1358* “Page settings” can now be accessed for any page in the trash via “reorganize.” When
1359working with `apostrophe-workflow`, this is
1360often required to commit the fact that a page is in the trash.
1361* The `uploadfs` module now has a `prefix` option. If present, the prefix is prepended to all uploadfs paths before they reach the storage layer, and is also prepended to URLs. In practice, this means that a single S3 bucket can be used to host multiple sites without all of the uploaded media jumbling together in `/attachments`. The `apostrophe-multisite` module now leverages this.
1362
1363## 2.62.0 (2018-08-09)
1364
1365Unit tests passing.
1366
1367Regression tests passing.
1368
1369* Introduced a `findWithProjection()` method that is added to all MongoDB collection objects. All Apostrophe core modules are migrating towards using this method rather than `find()` when working **directly with MongoDB collections**. If you are using the standard MongoDB 2.x driver that is included with Apostrophe, this just calls regular `find()`. When using the forthcoming `apostrophe-db-mongo-3-driver` module to replace that with a newer driver that supports the full features of MongoDB 3.6, 4.0 and beyond, this method will provide backwards compatibility by accepting a projection as the second argument like `find()` did until the 3.x driver was released. Developers wishing to be compatible with both drivers will want to start using this method. Again, this **only concerns you if you are querying MongoDB directly and passing a projection to find() as the second argument**. And if you don't care about using the 3.x driver, you **do not have to change anything**.
1370* Various UX improvements and bug fixes to the page versions dialog box. Thanks to Lars Houmark.
1371* The widget wrapper is updated on the fly with new classes if they change due to edits. Thanks to Fredrik Ekelund.
1372* When configuring a `date` field, you may pass a `pikadayOptions` property. This object is passed on to the `pikaday` library. Thanks to Lars Houmark.
1373* The `counts: true` option for `piecesFilters` now works properly with joins.
1374
1375## 2.61.0 (2018-08-01)
1376
1377Unit tests passing.
1378
1379Regression tests passing.
1380
1381* New "secrets" feature in `apostrophe-users` makes it easy to hash other "secrets" similar in spirit to passwords.
1382* This feature is now used for password reset tokens, making them more secure.
1383* Additional joins can now be added to the schema of a widget that extends `apostrophe-pieces-widgets`.
1384* Brute force password attacks against an Apostrophe server are now more difficult. Thanks to Lars Houmark.
1385* Tolerant sanitization of array items while they are still in the editor. This avoids confusion caused by `required` fields in the array editor.
1386* Error messages now behave sensibly when multiple label elements appear in a field. Thanks to Lars Houmark.
1387* Fix background color on notification on uploads when file extension is not accepted. Thanks to Lars Houmark.
1388* If you can't move a widget out of an area, you can no longer move widgets into that area either (movable: false is fully enforced). Thanks to Fredrik Ekelund.
1389* New browser-side events are emitted during the attachment upload process, and the built-in facility that delays the saving of a form until attachment uploads are complete has been fixed. Thanks to Lars Houmark.
1390* Fixes to the active state display of array items. Thanks to Lars Houmark.
1391* [Contributor Guide](https://github.com/apostrophecms/apostrophe/blob/master/CONTRIBUTING.md) expanded with lots of new information about practical ways to contribute to Apostrophe.
1392* [Contributor Covenant Code of Conduct](https://github.com/apostrophecms/apostrophe/blob/master/CODE_OF_CONDUCT.md) added to the project. The Apostrophe community is a welcoming place, and now is a great time to lock that in for the future.
1393
1394## 2.60.4 (2018-07-13)
1395
1396Unit tests passing.
1397
1398Regression tests passing.
1399
1400* Shallowly clone the required definition in defineRelatedType to prevent yet more crosstalk between instances of apos when `apostrophe-multisite` is used. No other changes.
1401
1402## 2.60.3 (2018-07-13)
1403
1404Unit tests passing.
1405
1406Regression tests passing.
1407
1408* Improved support for nested areas and widgets. Apostrophe now pushes the correct doc id and dot path all the way to the page in various situations where this could previously have led to errors at save time.
1409* The new `apos.locks.withLock(lockName, fn)` method can be used to execute a function while the process has the named lock. This ensures that other processes cannot run that function simultaneously. You may optionally pass a callback, otherwise a promise is returned. Similarly `fn` may take a callback, or no arguments at all, in which case it is expected to return a promise.
1410* Cleanup: don't call `server.close` unless we've succeeded in listening for connections.
1411
1412## 2.60.2 (2018-07-12)
1413
1414Unit tests passing.
1415
1416Regression tests passing.
1417
1418* Version 2.60.1 broke validation of schema fields which were
1419`required`, but blank because they were hidden by `showFields`.
1420This is of course permitted, `required` applies only if the field
1421is active according to `showFields` or not addressed by any
1422`showFields` possibilities at all. Comprehensive unit testing was
1423added for this issue to prevent a recurrence.
1424* Version 2.60.1 also introduced a more subtle issue: if constraints
1425like `required` or `min`, or general improvements to validation such
1426as NaN detection for integers and floats, were added to a widget schema later
1427after content already existed then it became impossible to open a widget
1428editor and correct the issues. Validation tolerance was added for this
1429situation.
1430* When a user edits an area "in context" on the page, the server now
1431reports errors using a path that can be used to identify the widget
1432responsible and open its editing dialog box. A more relevant notification
1433is also displayed. This remains a secondary mechanism. Server-side
1434validation is mostly about preventing intentional abuse. Browser-side
1435validation is still the best way to provide feedback during data entry.
1436
1437## 2.60.1 (2018-07-11)
1438
1439Unit tests passing.
1440
1441Regression tests passing.
1442
1443* Fields of type `checkboxes` now play nicely with the `live/draft` toggle of `apostrophe-workflow`.
1444* Improved validation of integers and floats. Thanks to Lars Houmark.
1445* The "Global" dialog box now follows the same pattern as that for other piece types, which means that the workflow dropdown menu is available if workflow is present.
1446* Options may be passed to the `express.static` middleware that serves the `public` folder, via the `static` option of the `apostrophe-express` module. Thanks to Leonhard Melzer.
1447* `apostrophe` now depends on `bluebird` properly and there are no lingering references to the wrong version fo `lodash`. Formerly we got away with this because some of our dependencies did depend on these, and npm flattens dependencies. Thanks to Leonhard Melzer.
1448* The new `eslint-config-punkave` ruleset is in place, and includes a check for "unofficial dependencies" in `require` calls that could go away suddenly.
1449* `fieldClasses` and `fieldAttributes` may be set on form fields themselves, similar to the existing `classes` and `attributes` properties that are applied to the `fieldset`. Thanks to Lars Houmark.
1450* The "Pages" admin UI now includes a "New Page" button, in addition to the usual "reorganize" functionality. Thanks to Lars Houmark.
1451* Fixed a crash when an `apostrophe-pieces-widget` is configured to always show all pieces via `by: 'all'`. Thanks to Aurélien Wolz.
1452* General UI styling improvements and fixes.
1453
1454## 2.60.0 (2018-07-06)
1455
1456Unit tests passing.
1457
1458Regression tests passing.
1459
1460* New feature: you can now display counts for each tag, joined item, etc. when using the `piecesFilters` option of `apostrophe-pieces-pages`. Just add `counts: true` to the configuration for that filter. The count is then available in a `.count` property for each value in the array. See [creating filter UI with apostrophe-pieces-pages](https://apostrophecms.org/docs/tutorials/intermediate/cursors.html#creating-filter-u-i-with-code-apostrophe-pieces-pages-code) for more information.
1461* New feature: command line tasks such as `apostrophe-blog:generate` may now be run programmatically, for example: `apos.tasks.invoke('apostrophe-blog:generate', { total: 50 })`. A promise is returned if a callback is not passed. Note that not all tasks are written to behave politely and invoke their callback normally, however most do. This feature is most useful when writing tasks that logically should incorporate other tasks.
1462* Many UX and UI improvements that make the experience more pleasant in subtle and not-so-subtle ways. Thanks to Carsten, Marco Arnone and the prolific Lars Houmark for their contributions. This was an excellent week for Apostrophe PRs.
1463* The full set of controls for joined items are again available in the chooser, as well as in the browse modal.
1464* The automatic opening of the admin bar menu on page load can now be configured with the `openOnLoad`, `openOnHomepageLoad`, and `closeDelay` options.
1465* `autocomplete="off"` for date fields prevents chrome autocomplete suggestions from wrecking calendar UI.
1466* Always remove .apos-global-busy on unlock, even if the transition event never fires. Yes, that is sadly a thing. Prevents the UI from becoming unusable in rare situations (less rare inside functional tests).
1467* Use `one` to reduce the overhead of .apos-global-busy's transition event handler. We could do more here to reduce overhead, i.e. unhooking it entirely.
1468* Much-improved validation of `min`, `max` and `required` for strings, integers and floats on both the server and the browser side. Thanks to Lars Houmark.
1469
1470## 2.59.1 (2018-07-02)
1471
1472Unit tests passing.
1473
1474Regression tests passing.
1475
1476* Widget schemas now support the `def` property for fields. This always worked for pieces and pages.
1477* Accommodations for functional testing in nightwatch. The currently active Apostrophe modal, and all of its proxies such as its controls that are in a separate div for presentation reasons, now has the attribute `data-apos-modal-current` which is set to the class name of the modal. This powers the new [apostrophe-nightwatch-tools](https://npmjs.org/package/apostrophe-nightwatch-tools) module, which provides reusable commands and steps that can be used to create test projects similar to our [apostrophe-enterprise-testbed](https://github.com/apostrophecms/apostrophe-enterprise-testbed). Testing with the enterprise testbed project is a standard part of our release process.
1478* Previously if workflow was in use slugs could not be reused by new pages when the original page was in the trash. This has been addressed; the slug is now deduplicated in the same way that email addresses and usernames of users are when in the trash.
1479* The infinite scroll feature of `apostrophe-pieces-pages` now works as documented with the styles provided. The code is also more efficient and scroll events are throttled for performance. Thanks to Lars Houmark.
1480* Various UX fixes, thanks to Lars Houmark and various members of the Apostrophe team.
1481
1482## 2.59.0 (2018-06-15)
1483
1484Unit tests passing.
1485
1486Regression tests passing.
1487
1488* Fixed nested widget editing for existing widgets whose modal dialog boxes have been accessed (#1428).
1489* A clear warning message with instructions has been added for those who are seeing "unblessed" messages due to widget schemas and in-template `apos.area` calls that do not match (#1429). The easiest way to avoid this is to just mark the area `contextual: true` in your widget schema so it is edited *only* on the page. But if you really want to do both, the widget options must match.
1490* The mechanism that automatically makes slugs, paths and other keys unique now gives up eventually and reports the original duplicate key error. This makes it easier to debug your code if you are violating your own custom indexes that feature unique keys. It is possible to make the deduplicator aware of your own own properties that need to be made more unique on inserts if you wish, by implementing a `docFixUniqueError` method. *Please note:* this change is not a regression. Code that formerly never completed its task in this situation will simply report an error promptly rather than retrying inserts forever while degrading your database performance.
1491* A new profiling API has been added: the `apos.utils.profile` method. This method can be called to report how long code takes to run for later analysis. It does nothing in the default implementation; modules like our forthcoming profiler override it to give feedback on the speed of your code.
1492
1493## 2.58.0 (2018-06-13)
1494
1495Unit tests passing.
1496
1497Regression tests passing.
1498
1499* Polymorphic joins have arrived! You may now create joins like this:
1500
1501```javascript
1502{
1503 name: '_items',
1504 type: 'joinByArray',
1505 withType: [ 'apostrophe-blog', 'product', 'apostrophe-page' ]
1506}
1507```
1508
1509When you join with more than one type, Apostrophe presents a chooser that allows you to pick between tabs for each type. Note that `apostrophe-page` can be included, so you can pick a mix of pages and pieces for the same join.
1510
1511This feature is useful for creating navigation that may point to a variety of document types, without the need for an array of items with several different joins and a `select` element to choose between them.
1512
1513Polymorphic joins work for both `joinByOne` and `joinByArray`. Currently they are **not** available for `joinByOneReverse`, `joinByArrayReverse`, or pieces filters. Their primary use case is creating navigation widgets.
1514
1515* `apos.images.srcset` helper function added. You can use this function to generate a `srcset` attribute for responsive display of an image. Just pass an attachment to the helper:
1516
1517`<img srcset="{{ apos.images.srcset(apos.images.first(data.piece.thumbnail)) }}" />`
1518
1519A `src` attribute for backwards compatibility is always advisable too.
1520
1521Thanks to Fredrik Ekelund for this contribution.
1522
1523* Fast forms for big schemas are back! The issue with tags has been resolved.
1524
1525* A single MongoDB connection may be reused by several `apos` objects for separate sites, a feature which is exploited by the [apostrophe-multisite](https://github.com/apostrophecms/apostrophe-multisite) module. Note that this only reuses the connection, it does not share a single MongoDB database. It *does* allow you to keep potentially hundreds of sites on a single MongoDB server or replica set, as the overhead of multiple logical "databases" is small in MongoDB's modern WiredTiger storage engine. To reuse a connection, pass it to the `apostrophe-db` module as the `db` option.
1526
1527* Fixed a MongoDB 3.6 incompatibility in the "Apply to Subpages" feature for permissions. Also made this feature available again when *removing* someone's permissions. We plan further UX work here to make this feature easier to understand and use.
1528
1529* UX fix to the "manage tags" dialog box: don't attempt to add an empty tag. Thanks to Anthony Tarlao.
1530
1531* Warn developers if they use bad area names.
1532
1533* For those deploying asset bundles to S3: the command line task that builds an asset bundle no longer requires access to your production database, although it still needs to start up normally with access to a database in the pre-production environment where you are building the bundle.
1534
1535* Refactoring of the trash field deduplication features, in preparation to extend them to pages as well in an upcoming release.
1536
1537## 2.57.2 (2018-06-07)
1538
1539Unit tests passing.
1540
1541Relevant regression tests passing.
1542
1543* New `extraHtml` block in `outerLayoutBase.html` allows your `outerLayout.html` to add attributes to the outer `html` element without the need to completely override the layout. It is a best practice to avoid completely overriding the layout because this maximizes your compatibility with future updates to our admin markup, etc.
1544
1545## 2.57.1 (2018-06-05)
1546
1547Unit tests passing.
1548
1549* Hotfix for bug in 2.57.0 that broke saving tags. We have reverted the "fast forms" change until the cause is understood.
1550
1551## 2.57.0 (2018-05-31)
1552
1553Unit tests passing.
1554
1555Functional tests passing.
1556
1557* Displaying and saving schema-driven forms is much, much faster.
1558This becomes very noticeable with 100 or more fields. With about
1559250 fields, this formerly took about 4.5 seconds to load or to
1560save such a form on a fast Mac. It now takes about 250 milliseconds.
1561* Users may re-order the items they have selected via drag and drop
1562when using "Browse" to select pieces, images, etc.
1563* Prior to this release, asset generation ids were surprisingly short and
1564made up only of digits due to an accidental holdover from an old version.
1565Conflicts were rare, but possible. Asset generation ids are now proper cuids,
1566no conflicts should occur.
1567* IDs may be added to notifications as a simple way to give other
1568code access to them.
1569* The `apos.global.addGlobalToData` method may now be called
1570with just `req` (returns a promise), with `req, callback` (invokes
1571the callback), or as middleware (which Apostrophe does by default).
1572This method is handy in command line tasks and other places
1573where middleware does not run and `req.data.global` is not populated
1574by default.
1575
1576## 2.56.0 (2018-05-17)
1577
1578Unit tests passing.
1579
1580Functional tests passing.
1581
1582* **Security:** numerous issues formerly flagged by the new `npm audit` command have been addressed. We are now using a [maintained branch of lodash 3.x](https://github.com/sailshq/lodash) to keep bc while addressing security (many thanks to the Sails team). We are also using LESS 3.x, which has caused no issues in our testing and corrects security concerns with LESS 2.x. Numerous `npm audit` security reports regarding `imagemin` modules were addressed by removing `imagemin` from `uploadfs` itself, however you may opt into it via the new [`postprocessors` option of `uploadfs`](https://github.com/punkave/uploadfs). As of this writing, one `npm audit` complaint remains: the `azure-storage` module needs to update a dependency to address a possible vulnerability. You may mitigate this issue by not using the `azure` backend of `uploadfs` with Apostrophe until it is resolved upstream.
1583* Many UI enhancements when choosing, browsing and managing items which reduce user confusion. For instance: moving items up and down in a selection no longer refreshes the entire list and forces the user to scroll down again. Trashed pages are easier to distinguish in "reorganize." "More" dropdown for pieces is again fully visible when clicked. Placeholder helpers make the search field for joins easier to understand. Chevrons added to various select elements which were difficult to identify as dropdowns before.
1584* Deeply nested areas now save properly. Formerly in certain situations the same widget might be duplicated.
1585* `apos.tasks.getReq` now supplies an empty `req.data` object for easier use with code expecting an Express request, Apostrophe-style.
1586* Bedeviled by case-sensitive sorting? The `sortify: true` property for `string` schema fields is now documented and automatically creates a database migration to ensure it is available for your existing data as well. When used, this flag ensures that any `sort('fieldname')` call for that field in Apostrophe is case-insensitive, ignores punctuation and otherwise behaves as end users expect.
1587
1588## 2.55.2 (2018-05-15)
1589
1590Unit tests passing.
1591
1592Relevant functional tests passing.
1593
1594* Reverted change to date formatting. `moment` will produce warnings again, but dates will not be a day old in some time zones, which is more important. We are working on a better fix for this problem.
1595
1596## 2.55.1 (2018-05-15)
1597
1598Unit tests passing.
1599
1600Relevant functional tests passing.
1601
1602* `apos.migrations.eachArea` no longer crashes the stack when iterating over a large number of documents without areas.
1603
1604## 2.55.0 (2018-05-11)
1605
1606Unit tests passing.
1607
1608Regression tests passing.
1609
1610* Security fix: uploaded images "in the trash" were still accessible at the same URL in most sizes. This has been corrected. As documented, the only size that now remains accessible is the `one-sixth` size, and this choice can be changed or eliminated entirely. **This bug did not affect other file attachments, such as PDFs.**
1611
1612As always, be sure to run the `apostrophe-migrations:migrate` task. This will make sure the permissions of your files are correct. Harmless warnings may appear for those that were already correct.
1613
1614* The `apostrophe-attachments:migrate-to-disabled-file-key` and `apostrophe-attachments:migrate-from-disabled-file-key` have been added for the convenience of those using the `disabledFileKey` option to `uploadfs` to rename disabled files in a cryptographically sound way rather than changing their permissions. These are relevant only with the `local` storage option of `uploadfs`, since since the option is neither available nor necessary for S3, and is mandatory for Azure from the beginning.
1615
1616* Although technically part of UploadFS 1.9.0, we'd like to note that the `azure` storage backend is now available and can be part of your `uploadfs` configuration for the `apostrophe-attachments` module.
1617
1618* Server-side modules can now extend the buttons available in the "manage" modal of pieces without overriding templates, similar to the way they are extensible in the "edit" modal.
1619
1620* UX fixes.
1621
1622* Cropping an image through Apostrophe now works when attachments are stored in S3, Azure, etc.
1623
1624* Date parsing does not generate `momentjs` warnings.
1625
1626* Overrideable block in the outerLayout for the context menu.
1627
1628* The `apostrophe-soft-redirects` module now accepts a `statusCode` option, which you may change to `301` to use hard redirects. Thanks to Leo Melzer.
1629
1630## 2.54.3 (2018-05-02)
1631
1632Unit tests passing.
1633
1634Regression tests passing.
1635
1636* Contextual editing of pieces found in a `widget.html` template saves properly, as does contextual editing of a nested area added to the page for the first time.
1637
1638* Previously executed migrations are remembered in a collection that persists, not just in a cache, avoiding extra work which could be extensive in a large database. Migrations are still required to be idempotent (they should detect whether they have any work to do, and do no harm if they are not needed again for a particular document).
1639
1640* `apos.migrations.eachWidget` now delivers an accurate `dotPath`, which is crucial for the use of `apos.docs.db.update` with `$set`. No standard migrations in Apostrophe were using the feature until now.
1641
1642## 2.54.2 (2018-04-24)
1643
1644Unit tests passing.
1645
1646Regression tests passing.
1647
1648* A bug in the recently introduced `apostrophe-soft-redirects` module caused crashes in cases where the context page or piece had no `_url` property... which is an unusual situation (how did you get there exactly? Overrides are clearly involved), but it can happen in customized projects. Fixed.
1649
1650## 2.54.1 (2018-04-24)
1651
1652Unit tests passing.
1653
1654Regression tests passing.
1655
1656* A bug in Chrome 66 causes problems when selecting images in Apostrophe's media library. This bug did not appear before Chrome 66 and does not appear in other browsers. We resolved it by migrating to the use of the CSS grid feature in compatible browsers.
1657
1658## 2.54.0 (2018-04-18)
1659
1660Unit tests passing.
1661
1662Regression tests passing.
1663
1664* Several performance improvements. In situations where Apostrophe formerly made expensive "matching nothing" queries, Apostrophe now either skips the entire query or uses an efficient query for a nonexistent `_id`, depending on whether the method in question has the right to cancel the entire operation.
1665* Resources released more completely by `apos.destroy`, which can now satisfy the expectations of `mocha` 5.x (no timeouts left active, etc). This was done by adding a `destroy` method to `uploadfs`.
1666* `range` schema fields behave better when there is no existing value.
1667* Save operation of a modal now triggers the global busy state to prevent race conditions and other unwanted behavior.
1668* Global busy state can now be pushed and popped, and modals utilize this, so that a modal can be used to gather information during the `saveContent` method of another modal.
1669
1670## 2.53.0 (2018-04-11)
1671
1672Unit tests passing.
1673
1674Regression tests passing.
1675
1676* Do not send X-XSRF-TOKEN headers in an OPTIONS request. This change was mistakenly left out of the 2.52.0 release.
1677* The named anchor `main` can now be overridden via the `mainAnchor` nunjucks block.
1678* The `npmRootDir` option can be used to cause Apostrophe's module loading mechanism to seek npm modules in a location other than that specified by `rootDir` (or the project root). The new `localesDir` option of `apostrophe-i18n` does the same for localization. This makes it possible to use `rootDir` to specify an alternate location for everything else, i.e. the parent of `public`, `data`, `lib/modules`, etc. A necessary accommodation for the evolving `apostrophe-multisite` module.
1679* Raw HTML widgets now offer help text out of the box.
1680* The `express.static` middleware now runs before the `apostrophe-global` middleware and other "standard" Apostrophe middleware.
1681* Your own module-level `expressMiddleware` object can specify `{ when: 'beforeRequired', middleware: function(req, res, next) { ... })` to run before the required middleware as well. Note that this means no sessions, no users and no body parser. Most of the time you'll want those things.
1682* CSS adjustment to tabs in modals so they don't scroll in Firefox.
1683* Dropzones for empty areas are easier to drop onto.
1684
1685## 2.52.0 (2018-03-30)
1686
1687Unit tests passing.
1688
1689Regression tests passing.
1690
1691* No more 404's when slugs change for pages and pieces. Apostrophe now automatically implements "soft redirects" to the new URL of a page or piece. This is a major SEO improvement, with good support for any page or piece with a `._url` property. Note that this feature "learns" URLs over time as the pages and pieces are actually accessed, so if you decide to test it, remember that you must access the old URL at least once before you change it for the test. This feature can be disabled, if you really want to, by setting the `enable` option of the `apostrophe-soft-redirects` module to `false`.
1692* Indexed queries on the `parkedId` and `advisoryLock._id` properties. The lack of indexes for these properties could lead to full collection scans, so this is a significant performance boost on large databases.
1693* Apostrophe's anti-CSRF forgery X-XSRF-TOKEN header is no longer sent as part of an OPTIONS request, or as part of a cross-domain request. In the first case, cookies cannot be set by the server anyway, and in the second, we are communicating with a server that cannot see our session to verify it. In both cases, sending the headers was causing configuration headaches for developers. Thanks to Priyansh Gupta.
1694* A UI bug fix: the recently added "clone" button for widgets is no longer displayed for singletons, or for areas whose `limit` has been reached. Also, the `cloneable: false` option can be used to disable this feature for a particular area.
1695* UI bug fix: no more conflicts between the "Add Content" menu and the up/down/remove/etc. buttons for widgets.
1696* Clearer warnings and error messages.
1697
1698## 2.51.1 (2018-03-27)
1699
1700Unit tests passing.
1701
1702Regression tests passing.
1703
1704* Do not crash when updating a doc if widgets exist but `_originalWidget` does not. This can happen in workflow scenarios where Apostrophe's `find` is bypassed.
1705* Accommodations for the forthcoming `apostrophe-optimizer` module.
1706
1707## 2.51.0 (2018-03-21)
1708
1709Unit tests passing.
1710
1711Regression tests passing.
1712
1713* Widget fields may now have a `permission` property. If present, the user must have the named permission (such as `admin`), or they will not see that particular field in the editing dialog box. This is useful when a widget should be authorable by most users but has a sensitive field that should be restricted to a smaller group of users. Note that this feature already existed for schema fields of pieces and pages.
1714* Apostrophe again allows a named pipe to be specified via the `PORT` environment variable, for compatibility with Windows. Thanks to Jørgen M. Skogås for this fix.
1715* Apostrophe's default settings for the `bodyParser` option are now generous enough, in the case of JSON request bodies, to cover all reasonable editing scenarios in Apostrophe. This change also benefits the `apostrophe-headless` module.
1716* When Apostrophe must generate a `path` for a new page, it will look at the provided `slug` before it looks at the provided `title`. This is useful when titles in an import are of poor quality but slugs are unique. Prevents unnecessary numbered suffixes after both slugs and paths.
1717* The dropdown menu to add a widget no longer has a conflict with the hover menu offering widget controls such as "up," "down," etc. The hover menu does not appear while the dropdown menu is open.
1718
1719## 2.50.0 (2018-03-14)
1720
1721Unit tests passing.
1722
1723Regression tests passing.
1724
1725* Clone button for widgets in areas, to save time when editing.
1726* New features for displaying the titles of array items when editing fields of type `array`. `titleField` may now use dot notation. In addition, if that isn't enough, you may use `listItemTemplate` to point to an alternative to the standard `arrayListItem.html` template, which you may use as a reference. In addition, both `titleField` dot notation and the custom `listItemTemplate` have full access to joins. Be sure to use cross-module include syntax if you don't want to put the template in `lib/modules/apostrophe-schemas/views`. For instance, you may write `listItemTemplate: 'my-module-name:listItemTemplate.html'`.
1727* Bug fix: modals are the right height when jQuery 3 is in use.
1728* CSS class added to the `h4` that displays the title in an `apostrophe-images` widget, for your CSS styling convenience. Thanks to Gareth Cooper.
1729
1730## 2.49.0 (2018-03-09)
1731
1732Unit tests passing.
1733
1734Regression tests passing.
1735
1736* New password reset feature. You will need to configure `apostrophe-email` and opt into this feature. See the new [Apostrophe password reset HOWTO](https://apostrophecms.org/docs/tutorials/howtos/password-reset.html).
1737* Significant performance boost to the "reorganize" modal in situations where numerous pages are in the trash when using the `apostrophe-workflow` module.
1738* If widget ids are not provided when inserting new documents they are automatically generated. This makes [apostrophe-headless](https://npmjs.org/package/apostrophe-headless) easier to use.
1739
1740## 2.48.0 (2018-03-01)
1741
1742Unit tests passing.
1743
1744Regression tests passing.
1745
1746* New `color` and `range` schema field types. `color` provides a color picker field allowing values compatible with CSS, etc. `range` provides an `<input type="range">` element and respects `min` and `max` options.
1747* New `apos.utils.log`, `apos.utils.info`, `apos.utils.debug`, `apos.utils.warn` and `apos.utils.error` methods. These are now used consistently throughout Apostrophe core, both in the server and in the browser. On the server, these methods wrap the corresponding methods of a `logger` object and you can inject your own via the `logger` option of the `apostrophe-utils` module. By default a logger object that wraps the `console` object is created. For convenience, if your logger has no `log` method, `apos.utils.log` will call `logger.info`. This allows many popular loggers like `winston` to be used without modification "out of the box."
1748* `modulesSubdir` option to specify subdir where local modules come from, overriding `lib/modules`. Useful when more than one `apos` object exists in a project.
1749* Major speedup to parked pages. Also eliminates spurious warnings about inefficient joins at startup.
1750* Refactored autocollapse behavior of admin bar into its own method for easier overrides.
1751* CSS fixes for improved usability.
1752
1753## 2.47.0 (2018-02-14)
1754
1755Unit tests passing.
1756
1757Regression tests passing.
1758
1759* Developers now have the option to use jQuery 3. To enable jQuery 3, set the `jQuery` option of the `apostrophe-assets` module to the number `3`. We have packaged specific versions of jQuery 3 and jQuery UI which are known to be compatible with and tested with Apostrophe's UI, and we plan to use these in our own projects going forward. We will be making this change in the apostrophe boilerplate project. Of course Apostrophe's UI remains compatible with the older version of jQuery that loads by default. There is no bc break.
1760
1761* When you join with pages, by using the virtual doc type `apostrophe-page`, the user is now invited to choose a page via a version of the reorganize dialog box, which has been made more user-friendly for this purpose. Autocomplete is still supported too.
1762
1763* The reorganize dialog box is more pleasant to use. This dialog will continue to evolve to offer more of the functionality found in the "manage" dialog boxes for piece types.
1764
1765* The page parking mechanism has been overhauled and improved. From now on, it is our recommendation that you set a unique `parkedId` for each parked page you configure for `apostrophe-pages`. This ensures that even if you change the slug in the configuration of the parked page, Apostrophe will still be able to understand that the page already exists and a new one should not be inserted. This is especially critical if using `apostrophe-workflow`, since you might decide to add or change locale prefixes at some point.
1766
1767* The database connection keepalive mechanism now uses a query against an empty collection, rather than a server status call that the database user might not have permission to make.
1768
1769* The `apos.utils.cssName` helper now preserves double dashes, as they are a common feature in modern CSS frameworks.
1770
1771* There is now an `apostrophe-areas:widgetBase.html` file which can be extended block by block in a project-level `lib/modules/apostrophe-areas/views/widget.html` file. New overrideable methods have also been added to simplify adding custom classes programmatically to the wrapper and the widget itself without overriding any templates.
1772
1773* It is now possible to configure select elements (we do not recommend more than one) to be displayed inline with the other widget controls, i.e. up, down, delete, etc. The back end of this is left to the developer, however you can check out the still-evolving [apostrophe-personas](https://github.com/apostrophecms/apostrophe-personas) module for an example. This feature is primarily meant for modules like `apostrophe-personas` that impact all widgets in a general way.
1774
1775## 2.46.1 (2018-01-30)
1776
1777Unit tests passing.
1778
1779Regression tests passing.
1780
1781* Attachment fields now save properly when directly part of the schema of a widget. A bug was introduced in version 2.42.0 when the `length` property was added to attachments. A fix made long ago to `apos.utils.clonePermanent` on the server side was also needed on the browser side.
1782
1783## 2.46.0 (2018-01-25)
1784
1785Unit tests passing.
1786
1787Regression tests passing.
1788
1789* The "Copy" button of pieces now copies areas that do not explicitly appear in the schema, and works correctly when an `apostrophe-pieces` module is set `contextual: true`. Overrideable methods are provided for those who need to copy more than schema fields and top-level areas. We do not copy every property by default because this could have unforeseen consequences; we copy only what is in the schema, plus top-level areas because these have always been supported without an explicit schema in templates.
1790
1791* It is now possible to secure widget properties so that they are not visible to end users if you do not choose to output them in the markup. To do that, set the `playerData` option of your widget module to `false`, or to an array of properties that **should** be visible in the `data` JSON attribute so that they are passed to the `play()` method. Normally widget properties are public information, intended for display, but this technique is useful if you have a `username` and `password` for use in fetching an external feed in a server-side `load` method, for instance. **Note that to allow widget editing to function, everything is still passed in `data` if the user has editing privileges for the widget.** So if you seek to verify this feature, be sure to check as a logged-out user, or a user without editing permissions for that content.
1792
1793* It is now easy to override the `fieldset` markup for Apostrophe schemas. Just copy `lib/modules/apostrophe-schemas/views/fieldset.html` to your project-level version of that path and edit it. However, please note that you must continue to have an outer wrapper element with the given attributes.
1794
1795* Apostrophe's codebase now passes `eslint`. In the process many cases of callback errors being ignored were fixed, as well as global variable leaks.
1796
1797* Apostrophe's `apos.locks.lock` and `apos.locks.unlock` methods now support promises.
1798
1799## 2.45.0 (2018-01-11)
1800
1801Unit tests passing.
1802
1803Regression tests passing.
1804
1805* The `apostrophe-caches` module has better, clearer documentation and it now supports promises.
1806* All modules can now conveniently send email using [Nodemailer](https://nodemailer.com/about/). The new `email` method of all modules renders a template in that module's `views` folder, exactly as you would hope it would, and also automatically generates a plaintext version for the occasional user who does not view HTML email. The automatically generated versions include links properly.
1807* Extending `apostrophe-images-widgets` and other pieces widgets is easier. If your widget name doesn't correspond to the kind of piece you are displaying, a helpful error appears explaining that you need to set `piecesModuleName`. Adding fields to these widgets now behaves reasonably. Also, if you add fields to `apostrophe-images` or `apostrophe-files` at project level, this now behaves as expected too.
1808* A locking mechanism has been added during the movement of pages in the page tree. This prevents rare race conditions that could previously have resulted in duplicate page ranks, although the design of the page tree is such that more serious consequences were always avoided.
1809* Text justification options for ckeditor are now standard in our build of ckeditor. Of course you still need to configure `sanitize-html` properly when using them.
1810* Any widgets module may now specify a `wrapperTemplate` option. That template is rendered instead of the standard `apostrophe-areas:widget.html` template, and can use `extends` and override blocks found in that template. This is useful if you need to set attributes of the outer wrapper element of the widget.
1811* The migration added in 2.43.0 to address file permissions for existing attachments in the trash has been greatly accelerated, helpful on large sites.
1812* Better error messages for `min` and `max` options of some schema field types; provisions for expanded error messages in general.
1813* For those using the `testModule` option to test their own npm modules in the context of Apostrophe, a default shortname is automatically provided.
1814* Fixed missing space in admin bar markup, thanks to arlecchino.
1815
1816## 2.44.0 (2017-12-15)
1817
1818Unit tests passing.
1819
1820Regression tests passing.
1821
1822* Apostrophe's AJAX filter features for `apostrophe-pieces-pages` now support "Load More" buttons and infinite scroll.
1823
1824To add a "Load More" button:
1825
18261. Wrap a new element inside your data-apos-ajax-context element around the content that makes up the current "page" of results. This should not wrap around filter links or the "Load More" button itself.
18272. Give that new element the `data-apos-ajax-append` attribute.
18283. Add `append=1` to the query string of your Load More button. Example:
1829
1830```
1831{% if data.currentPage < data.totalPages %}
1832 <a href="{{ data.url }} | build({ page: data.currentPage + 1, append: 1 })">Load More...</a>
1833{% endif %}
1834```
1835
1836To progressively enhance this for infinite scroll, add a `data-apos-ajax-infinite-scroll` attribute to the button.
1837
1838Note that we do this via progressive enhancement of a "Load More" button so that Google can still reach and index all of the pages (SEO).
1839
1840* Attachment schema fields now respect the new `fileGroup` and `fileGroups` properties. If `fileGroup` is set to `images`, then only image types (GIF, JPEG, PNG) are accepted; if it is set to `office` only typical business file types are accepted. Note that we have always rejected files that didn't appear on the list for either type. You can also specify `fileGroups` as an array.
1841* `fileGroup: 'image'` is now configured by default for `apostrophe-images`, as was always intended but incorrectly implemented in the past.
1842* Attachment schema fields now respect the new `extension` and `extensions` properties. The former is handy if you only want to allow one extension, the latter if you want to allow more than one. The extensions must be those specified for `fileGroups` in the default configuration of `apostrophe-attachments` or your override of it (all lower case; JPEG is `jpg`; no period).
1843* The `addDocReferences` migration has been parallelized, as this one-time migration can be time-consuming on a large site.
1844* Broken `less` calculation fixed, thanks to Antoine COMBES.
1845
1846## 2.43.0 (2017-12-12)
1847
1848Unit tests passing.
1849
1850Regression tests passing.
1851
1852* When a "file" or "image" is moved to the trash, the attachment in question now becomes inaccessible. This is particularly important to stop access to obsolete PDFs, which Google loves to access. If the file or image is removed from the trash, the attachment becomes available again. In the case of images, the 1/6th size remains available by default to provide preview when viewing the trash. If the same attachment is referenced by more than one doc, which can happen due to "Copy" operations or `apostrophe-workflow`, it remains available until all such docs are in the trash.
1853
1854* Parked properties are no longer editable in page settings. Since every site restart always wiped them out anyway, this is a bug fix, not a truly new behavior. With this change, you can finally set `type: 'home'` when `park`ing the home page, and remove `home` from your page types dropdown.
1855
1856* The `apostrophe-jobs` module now offers a `runNonBatch` method, which is useful for long-running operations that don't involve iterating over many instances of the same type of object.
1857
1858* Improvements to background image positioning for images widgets.
1859
1860* A block has been added to override the `lang` attribute easily. Thanks to Ayho.
1861
1862* The `imgAlt` block can now be used to conveniently override the `alt` attribute of images when overriding `widget.html` for `apostrophe-images-widgets`. Thanks to Raphaël DiRago.
1863
1864* The `required` option now works properly for fields of type `array` (there must be at least one item in the array).
1865
1866* Improved error messages for unblessed widget schemas. These are usually related to a widget that is no longer in the page template but appears in the database.
1867
1868* A UI bug that caused tabs to become invisible when returning from nested dialog boxes has been fixed.
1869
1870* Filters for "select" fields now default to "no opinion," rather than the default choice. This is the normal behavior for other field types.
1871
1872* Even more promise support! `apos.attachments.insert`, `pieces.trash` and `pieces.rescue` all return promises if no callback is given.
1873
1874* A YouTube embed unit test was removed to ensure consistent results in Travis CI, which is once again in routine use.
1875
1876## 2.42.1 (2017-11-24)
1877
1878Unit tests passing.
1879
1880* Use of a capitalized filename that should have been lowercase in a `require` briefly broke Apostrophe's initialization on Linux. We are correcting this by reinstating CI in a Linux environment.
1881
1882## 2.42.0 (2017-11-22)
1883
1884Unit tests passing.
1885
1886Regression tests passing.
1887
1888* 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.
1889
1890In addition, `docs.insert`, `docs.update`, `pieces.insert`, `pieces.update`, and `pages.insert` will all return a promise if invoked without a callback.
1891
1892These are the most frequently invoked functions in Apostrophe that formerly required callbacks.
1893
1894**As always with promises, be sure to catch errors with `.catch()`** at some level.
1895
1896Note 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.
1897
1898* 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.
1899
1900* 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.
1901
1902Only `_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`.
1903
1904*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`.*
1905
1906* 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.
1907
1908* Fixed bug in the `isEmpty` methods for areas and singletons. Thanks to David Keita.
1909
1910## 2.41.0 (2017-11-17)
1911
1912Unit tests passing.
1913
1914Regression tests passing.
1915
1916* The new `apostrophe-jobs` module, part of the core of Apostrophe, provides a progress meter mechanism and the ability to stop long-running user-initiated operations, such as batch operations on pieces. See the [jobs module documentation](http://apostrophecms.org/docs/modules/apostrophe-jobs/index.html). You can also refer to the pieces module for examples if you wish to use this for your own long-running user-initiated operations.
1917* Batch operations now have more robust support for "select everything." A number of bugs related to multiple selection of pieces have been fixed in a refactoring that made this code much more maintainable and predictable.
1918* The option of pushing an asset of type `template`, which never worked in 2.x and was never used by Apostrophe, has been removed for clarity. Our preference is for rendering assets on the server side dynamically when needed, rather than pushing many templates into the DOM on every page load.
1919* An `.editorconfig` file has been added. Thanks to Fredrik Ekelund.
1920* Parking a page only pushes permanent properties. `_defaults` and `_children` should never have been in the database; they are of course still interpreted to decide what should happen, but the properties *themselves* did not belong in the database. (You may need to write a migration if they are already there and this is causing issues for you.)
1921* Scrolling UI behavior of pieces improved; various other UI touch-ups. Thanks to Fredrik Ekelund.
1922* `newBrowserCalls` helper for `push` module can be used when you want JavaScript calls queued up with `req.browserCall` to be executed in an AJAX update of just part of a page.
1923* Fixed bugs affecting access to the published/unpublished batch operations and similar.
1924
1925## 2.40.0 (2017-11-10)
1926
1927Unit tests passing.
1928
1929Regression tests passing.
1930
1931* Support for "select everything" when managing pieces. Once you check the box to select everything on the current page, you are given a secondary option to select everything that matches your current criteria. This works both when choosing pieces for widgets and when working with batch operations like "trash" or "rescue."
1932* Fixed various bugs affecting combinations of "select all on page", the chooser and working with images.
1933* Improvements to batch operations on pieces. The `requiredField` property is checked correctly, and the new `onlyIf` property allows for passing a function that accepts the doc type name and decides whether the button should appear. Multiword action names are properly camelcased. New "success" and "dataSource" options to `batchSimple` allow for carrying out additional operations afterward as well as gathering input independently at the start. And batch operations are composed late so that other modules can add them.
1934* The `self.api` and `self.html` methods of `apostrophe-context` and `apostrophe-modal` now support a syntax for making cross-module API calls, just like templates.
1935* Addressed moog versioning issue with latest npm that caused errors about "synth.instanceOf" not being found depending on the state of your npm cache.
1936
1937## 2.39.2 (2017-11-02)
1938
1939Unit tests passing.
1940
1941Startup-related regression tests passing.
1942
1943* The `APOS_MONGODB_LOG_LEVEL` environment variable can now be set to `debug`, `info` or anything else supported by the MongoDB driver's `Logger.setLevel` method. This is helpful for debugging database issues at the lowest level.
1944
1945## 2.39.1 (2017-11-01)
1946
1947Unit tests passing.
1948
1949Regression tests passing.
1950
1951* Factored out a `getBaseUrl` method for `apostrophe-pages`, allowing
1952overrides of this that pay attention to `req`.
1953* Report `pageBeforeSend` errors and failures to load the global doc properly, don't silently tolerate them.
1954* Documentation corrections. Thanks to Frederik Ekelund.
1955
1956
1957## 2.39.0 (2017-10-24)
1958
1959Unit tests passing.
1960
1961Regression tests passing.
1962
1963* Easier access to options. Introduced the `getOption` method to all modules. Calling `self.getOption(req, 'sizes.large')` from your module's server-side JavaScript code, or just `module.getOption('sizes.large')` from Nunjucks, will return the value of `self.options.sizes.large` for that module. You may also pass an array of keys, i.e. `module.getOption([ 'sizes', 'large' ])`. This method is tolerant, it returns undefined if any part of the path does not exist. See also the new [apostrophe-override-options](https://npmjs.org/package/apostrophe-override-options) which extends this feature to support customizing the returned value for any option based on the current page type, page settings, piece settings and locale. * Helpful warning when maximum area/widget loader recursion level is reached. Always use projections when adding joins to your schema to avoid a performance hit due to runaway recursion.
1964* New `disabledTypes` option to `apostrophe-pages`, primarily for use with `apostrophe-override-options`.
1965* Fixed UI bug relating to area menus at the bottom of the page.
1966* Fixed bug that caused a crash when invalid usernames attempted to log in. Thanks to Arthur.
1967
1968## 2.38.0 (2017-10-16)
1969
1970Unit tests passing.
1971
1972Regression tests passing.
1973
1974* Various schema field validators for required fields no longer crash on the browser side if a property is nonexistent, as opposed to being the expected empty string.
1975* Buttons for editing pieces widgets now use less confusing language.
1976* Accommodations for the `apostrophe-headless` module (arriving later today), including factoring out certain login-related and piece-related functionality to separate methods in order to make it easier to introduce RESTful APIs for the same features.
1977* Unit tests no longer drop the entire test database between suites; instead they drop the collections. Also the unit test timeout can be set via an environment variable. This accommodates testing against various cloud databases with security that precludes dropping entire databases.
1978* Lots of new content in the README to get folks who haven't been to the documentation site yet a little more excited.
1979
1980## 2.37.2 (2017-10-04)
1981
1982Unit tests passing.
1983
1984Conflict resolution and template extension-related regression tests passing.
1985
1986* The conflict resolution feature, which helps users avoid conflicts in which neither is successfully able to save content reliably by explaining that two users are editing the same doc and offering the option of taking control, can now be disabled by setting the `conflictResolution` option of the `apostrophe-docs` module explicitly to `false`. **We do not recommend** the use of this option in normal practice, however it has valid applications in automated testing.
1987
1988* Recently a bug was introduced in which extensions other than `.html` or `.njk` did not work in `include` statements, etc. in Nunjucks templates unless the file in question existed in the project-level version of the module including it. The full cascade of template folder paths is now supported for these explicit extensions, including searching `viewsFolderFallback`.
1989
1990## 2.37.1 (2017-09-27)
1991
1992Unit tests passing.
1993
1994Piece- and schema-related regression tests passing.
1995
1996* Filters are now available for schema fields of type `integer`. You can configure these for the manage view, or for pieces-pages, exactly as you would for other field types. Previously this feature existed but did not function properly, so this is a patchlevel release rather than a minor version bump.
1997* Previously, when viewing pieces in the trash, the batch operation button initially read "Trash Items" rather than "Rescue Items." It did not match the selected operation in the select element, and did not perform the needed operation of rescuing items unless you switched operations and switched back again. This has been fixed.
1998
1999## 2.37.0 (2017-09-25)
2000
2001Unit tests passing.
2002
2003Regression tests passing.
2004
2005* New feature: you may now use the `.njk` file extension in addition to `.html` for your Nunjucks templates. In order to maximize the usefulness of this feature in the context of existing Apostrophe code, `.njk` is still checked for even if `.html` was specified when calling the `render` method. `.njk` is a convention adopted by the Nunjucks community and is supported by some syntax highlighters.
2006* Bug fix: drag-and-drop reordering and movement of widgets is once again functional. (The arrows worked all along.)
2007* Bug fix: drag-and-drop targets for widgets residing in areas nested in other widgets now appear and function properly.
2008
2009
2010## 2.36.3 (2017-09-20)
2011
2012Unit tests passing.
2013
2014Regression tests passing.
2015
2016* If an oembed provider responds with an HTTP error and a response that is not parseable as XML or JSON, Apostrophe no longer crashes (this fix is actually in the oembetter npm module). This fixes crashes on non-embeddable YouTube videos.
2017* If the oembed provider issues a 401 or 404 error, a relevant error message is given. Otherwise the generic error icon is still given.
2018
2019## 2.36.2 (2017-09-19)
2020
2021Unit tests passing.
2022
2023Regression tests passing.
2024
2025* Dragging and dropping will now automatically scroll the "reorganize" dialog box.
2026* Attempts to drag a page above or below the "Home" page in "reorganize" no longer cause a restart. Also, the interface rejects them gracefully.
2027* Attempts to drag a page below the trashcan are rejected gracefully.
2028* When `trashInSchema` is active, the "traditional" trash can sorts below "in-context" trash, and the traditional trash can receives the special label "Legacy Trash" to reduce confusion.
2029* When on page two (or higher) in the "manage" view of pieces, performing a text search now correctly resets to page one.
2030* Throw an error at startup if a forbidden schema field name is used in `addFields` configuration. For instance, `type` is forbidden for widget schemas, while `docPermissions` is forbidden for doc type schemas, and `_id` is forbidden for both. Note that field names like `title` that are already in the schema are *not* forbidden because re-adding a schema field replaces it, which is often done to change the label, etc. So we'll be adding more documentation about these to help developers avoid surprises if their intention was an entirely new field.
2031
2032## 2.36.1 (2017-09-13)
2033
2034Unit tests passing.
2035
2036Regression tests passing.
2037
2038* Spurious conflict resolution warnings for pieces fixed.
2039* Notifications are spaced properly, and in the upper right corner as intended, on all screens.
2040* Reorganize feature: upgraded to jqtree 1.4.2. Regression testing found no bc breaks.
2041* A debugging convenience: the `log(true)` cursor filter logs MongoDB criteria objects resulting from the cursor in question to the console.
2042
2043## 2.36.0 (2017-09-12)
2044
2045Unit tests passing.
2046
2047Regression tests passing.
2048
2049* You may now set the `skipInitialModal` option for any widget module to `true` in order to avoid displaying the editing dialog box when the widget is first added. This makes sense if the widget has a useful default behavior, or consists of a contextually editable rich text sub-widget with a "style" select element you might or might not need to set every time.
2050* Fields in Apostrophe's schema-driven forms now receive globally unique `id` attributes, and the `for` attributes of `label` elements now reference them properly.
2051
2052## 2.35.1 (2017-09-08)
2053
2054Unit tests passing.
2055
2056Regression tests passing.
2057
2058* Intermittent "not blessed" errors when editing joins in widget schemas have been corrected by blessing all widget schemas at page serve time, just as we already bless all doc type schemas at page serve time. Blessing them when the individual routes fire is problematic because of probable race conditions with sessions.
2059
2060## 2.35.0 (2017-09-06)
2061
2062Unit tests passing.
2063
2064Regression tests passing.
2065
2066* `apos.areas.isEmpty(data.page, 'body')` will now tell you if that area is considered empty (it contains no widgets, or the widgets consider themselves empty).
2067
2068* The new `controls` option may be passed to any widget, via `apos.singleton` or via the configuration for that specific widget type in an `apos.area` call. In this example, the widget cannot be removed, cannot be moved, and has its controls positioned at the upper right instead of the upper left:
2069
2070```
2071{{
2072 apos.singleton(data.page, 'footer', 'apostrophe-rich-text', {
2073 controls: {
2074 removable: false,
2075 movable: false,
2076 position: 'top-right'
2077 }
2078 }
2079 })
2080}}
2081```
2082
2083The `position` suboption may be set to `top-left`, `top-right`, `bottom-left` or `bottom-right`.
2084
2085The `removable` and `movable` suboptions are primarily intended for singletons.
2086
2087* By popular demand, the `insert` and `update` methods of pieces now pass the piece to their callback as the second argument.
2088
2089* Better CSS reset for Apostrophe's admin UI.
2090
2091* `callOne` added for convenience when you want to invoke a method normally invoked by `callAll` in the same way, but for only one module. Thanks to Arthur.
2092
2093* If an attachment does not exist, `apos.attachments.url` no longer results in a template error page. Instead a fallback icon is displayed and an error message is logged. Developers should still always check whether attachments and joined objects still exist in their templates. Thanks to Raphaël DiRago.
2094
2095* Notifications within modals move to lower right corner of modal for readability.
2096
2097* Cleaned up font paths.
2098
2099* Accommodations for the latest release of the separately published apostrophe-workflow module.
2100
2101## 2.34.3 (2017-08-31)
2102
2103Unit tests passing.
2104
2105Regression tests passing.
2106
2107A bug was fixed that prevented nested area editing. The bug appeared in version 2.34.0.
2108
2109Note that editing an area on the page has never been possible when it is part of the schema of an array field. That is not a new issue. It is being tracked and discussed. Today's fix was for a regression that impacted all nested areas.
2110
2111## 2.34.2 (2017-08-29)
2112
2113All tests passing.
2114
2115Fixed a bug that generated an error message regarding conflict resolution when attempting to edit an area inside a piece editor dialog box.
2116
2117## 2.34.1 (2017-08-28)
2118
2119All tests passing.
2120
2121Fixed an issue impacting unit test harness only. It didn't come up initially because it had to do with automatically creating `test/node_modules`, which existed our dev environment.
2122
2123No code changes outside of tests.
2124
2125## 2.34.0 (2017-08-28)
2126
2127All tests passing.
2128
2129* Conflict resolution has been added to Apostrophe. When two users attempt to edit the same document, whether "in context" on the page or via a dialog box, Apostrophe now makes the latecomer aware of the issue and gives them the option to take control of the document after warning that the first party could lose work.
2130
2131Since the first user may have simply abandoned their work, Apostrophe also indicates how long it has been since the first user last made a change.
2132
2133If the same user attempts to edit a document in two tabs or windows, something very similar happens, although the message is different.
2134
2135* In a related change, Apostrophe does not begin attempting to save an area on the page until the user interacts with it for the first time. This fixes many commonly reported frustrating situations in which one user is editing and the other is logged in but merely looking at the page, creating a ping-pong exchange of save requests.
2136
2137* Apostrophe's unit tests have been restructured so that a single test file can be run conveniently, via `mocha test/docs.js`, for instance, and there is no longer a need for us to update `test/test.js` every time a test is added. Also, the unit tests use the same `apos.tasks.getReq` and `apos.tasks.getAnonReq` methods that are used by real-life command line tasks, which provide a more faithful simulation of an Express request object and one we anticipate extending as needed.
2138
2139## 2.33.1 (2017-08-16)
2140
2141All tests passing.
2142
2143* Fixed potential crash in version pruning mechanism.
2144
2145## 2.33.0 (2017-08-10)
2146
2147All tests passing.
2148
2149* The login page can be disabled via the new `localLogin` option of the `apostrophe-login` module. Set it explicitly to `false` to disable the login URL completely.
2150* Refactoring: the `apostrophe-login` module now has an `afterLogin` method which takes care of invoking the `loginAfterLogin` callAll method on all modules that have one, and then redirecting appropriately. This code was factored out to make it easier to use in the new [apostrophe-passport](https://npmjs.org/package/apostrophe-passport) module, which allows the use of almost any [Passport](http://passportjs.org)-based strategy, such as Facebook login, Google login, Github login, etc.
2151* `apos.users.ensureGroup` now delivers the group to its callback as the second argument.
2152
2153Thanks to Michelin for their support of this work.
2154
2155## 2.32.0 (2017-08-08)
2156
2157All tests passing.
2158
2159* Fixed an S3 asset bundle generation bug that caused `.less` files to be imported with the wrong file extension if the `public` folder did not yet exist at the time `--create-bundle` was used. Thanks to Michelin for their support of this work.
2160
2161* Also added an `apostrophe-caches:clear` task to aid in testing various functionality. You must specify the cache name since caches may or may not even be known to Apostrophe at task startup time based on whether and when code calls `.get` for each cache name.
2162
2163## 2.31.0 (2017-08-07)
2164
2165All tests passing.
2166
2167* The new `testModule: true` option causes Apostrophe to supply much of the boilerplate for a published npm apostrophe module that wants to test itself as part of an apostrophe instance, i.e. apostrophe-workflow, apostrophe-caches-redis, etc. See those modules for examples of usage. This is a feature for those writing their own npm modules that wish to unit test by initializing Apostrophe and loading the module in question.
2168
2169* Fixed caching bugs, notably the oembed cache, which is now operating properly. Oembed responses, such as YouTube iframe markup, are now cached for an hour as originally intended which improves frontend loading time.
2170
2171* Page type changes only refreshed the schema fields on the first change — now they do it properly after every change.
2172
2173* Page type changes use the "busy" mechanism while refreshing the schema fields to prevent user interface race conditions and avoid user confusion.
2174
2175* `trash` is never offered as a schema field of the `global` doc (mainly a concern with `apostrophe-workflow`).
2176
2177## 2.30.0 (2017-08-02)
2178
2179All tests passing.
2180
2181It is now easier to set up Redis or another alternative session store:
2182
2183```
2184'apostrophe-express': {
2185 session: {
2186 secret: 'your-secret-here',
2187 store: {
2188 name: 'connect-redis',
2189 options: {
2190 // redis-specific options here
2191 }
2192 }
2193 }
2194}
2195```
2196
2197For bc, you can still pass a live instance of a store as the `store` option, but this way is easier; all you have to do is `npm install --save` your connect-compatible session store of choice and configure it.
2198
2199Thanks to Michelin for their support of this work.
2200
2201## 2.29.2 (2017-08-02)
2202
2203All tests passing.
2204
2205* Overrideable widgetControlGroups method takes (req, widget, options) allowing for better control when customizing these buttons.
2206* The `createControls` option of the `apostrophe-pages` module is now respewcted properly.
2207
2208## 2.29.1 (2017-07-31)
2209
2210All tests passing.
2211
2212* Fixed a short-lived issue with the reorganize feature.
2213
2214## 2.29.0 (2017-07-31)
2215
2216All tests passing.
2217
2218This is a significant update containing various accommodations required by the shortly forthcoming Apostrophe 2.x version of the `apostrophe-workflow` module, as well as other recent enhancements in our queue.
2219
2220* Editing an area "in context" on the page when it is part of a widget or piece will always work, even if `contextual: true` was not set. That property is optional and prevents the area from also appearing in the dialog box for editing the content type.
2221
2222* Multiple select filters are now available for the "manage" view of any piece type. Just like configuring single-select filters, except that you'll add `multiple: true` to the relevant object in your `addFilters` configuration for the module. Thanks to Michelin for their support of this work.
2223
2224* When editing a previous selection of pieces for a join or widget, you can also easily edit them without locating them again in the manage view.
2225
2226* "Next" and "previous" links can now be easily added to your `show.html` pages for pieces. Just set the `next` and `previous` options for your `apostrophe-pieces-pages` subclass to `true`, or to an object with a `projection` property for best performance. This will populate `data.previous` and `data.next` in your `show.html` template. *For blogs they may seem backwards; they refer to relative position on the index page, and blogs are reverse-chronological. Just switch the terms on the front end in your template in cases where they appear confusing.*
2227
2228* There is now a "pages" option on the admin bar, for cases where "reorganize" is not visible because "Page Settings" is not accessible to the user for the current page.
2229
2230* If the `trashInSchema` option is set to `true` when configuring `apostrophe-docs`, pages that are in the trash retain their position in the page tree rather than moving to a separate "trash" subtree. In the "reorganize" interface, they are grouped into trash cans displayed beneath each parent page, rather than a single global trash can. This is necessary for the new workflow module and also helpful in any situation where trying to find pages in the trash is more troublesome than explaining this alternative approach.
2231
2232When `trashInSchema` is `true`, users can also change the trash status of a piece or page via "Page Settings" or the "Edit" dialog box of the piece, and it is possible to access "Page Settings" for any page via "Reorganize."
2233
2234* The buttons displayed for each widget in an Apostrophe area can be adjusted via the `addWidgetControlGroups` option of the `apostrophe-areas` module, which can be used to introduce additional buttons.
2235
2236* Empty `beforeMove` and `afterMove` methods have been added to the `apostrophe-pages` module for the convenience of modules using `improve` to enhance it.
2237
2238* The `apostrophe-doc-type-manager` module now has `getEditPermissionName` and `getAdminPermissionName` methods. These can be overridden by subclasses. For instance, all page subtypes return `edit-apostrophe-page` for the former because page types can be changed.
2239
2240* `apos.destroy(function() { ... })` may be called to shut down a running Apostrophe instance. This does **not** delete any data. It simply releases the database connection, HTTP server port, etc. This mechanism is extensible by implementing an `apostropheDestroy` method in your own module.
2241
2242* `before` option for `expressMiddleware`. As before any module can provide middleware via an `expressMiddleware` property which may be a function or array of functions. In addition, if that property is an object, it may also have a `before` subproperty specifying a module whose middleware should run after it. In this case the actual middleware function or functions must be in a `middleware` subproperty.
2243
2244* `apos.instancesOf(name)` returns an array of modules that extend `name` or a subclass of it. `apos.instanceOf(object, name)` returns true if the given `object` is a moog instance of `name` or a subclass of it.
2245
2246* `apos.permissions.criteria` can now supply MongoDB criteria restricted to the types the user can edit when a general permission name like `edit` or `edit-doc` is asked for. *This was never a security bug because permissions for actual editing were checked when individual edits occurred. The change makes it easier to display lists of editable content of mixed types.*
2247
2248* Extending the indexes of Apostrophe's `aposDocs` collection is easier to achieve in modules that use `improve` to extend `apostrophe-docs`.
2249
2250* Removed tests for obsolete, unsupported Node.js 0.10.x. Node.js 4.x is now the minimum version. *We do not intend to break ES5 compliance in 2.x, however testing old versions of Node that are not maintained with security patches in any freely available repository is not practical.*
2251
2252* `insert` method for `apos.attachments`, mirroring the other modules better. Thanks to Arthur Agombart.
2253
2254## 2.28.0 (2017-07-17)
2255
2256All tests passing.
2257
2258* Notifications are available, replacing the use of `alert`. This feature is primarily for Apostrophe's own administrative features; you can use it when extending the editing UI. Call `apos.notify('message')` to display a simple message. You can specify several `type` options such as `error` and `info`, and you can also use `%s` wildcards. Everything is localized on the server side. [See the documentation for more information](http://apostrophecms.org/docs/modules/apostrophe-notifications/browser-apostrophe-notifications.html#trigger). Thanks to Michelin for their support of this work.
2259* The `apostrophe-images` widget now provides a focal point editor. See the new [responsive images HOWTO](http://apostrophecms.org/docs/tutorials/howtos/responsive-images.html). Thanks to Michelin for their support of this work.
2260* UX: clicking "edit" on an image you have already selected no longer deselects the image. Thanks to Michelin for their support of this work.
2261* Bug fix: corrected issue that sometimes prevented joins with pages from editing properly.
2262* Bug fix: added sort index on `level` and `rank`, preventing MongoDB errors on very large page trees.
2263* UX: a complete URL is suggested at startup when testing locally. Thanks to Alex Gleason.
2264
2265## 2.27.1 (2017-06-28)
2266
2267All tests passing.
2268
2269* Fixed recently introduced bug preventing page type switching.
2270
2271## 2.27.0 (2017-06-26)
2272
2273All tests passing.
2274
2275* Lazy schema field configuration, in general and especially for joins. No more need to specify `idField`, `idsField`, `relationshipsField` or even `label` for your schema fields. `withType` can be inferred too in many cases, depending on the name of the join field. You can still specify all of the details by hand.
2276
2277Also, for reverse joins, there is a new `reverseOf` option, allowing you to just specify the name of the join you are reversing. This is much easier to understand than specifying the `idField` of the other join. However that is still permitted.
2278
2279Lazy configuration is in place for doc types (like pages and pieces) and widget types. It can be extended to other uses of schemas by calling the new validation methods.
2280
2281* ckeditor 4.6.2. Resolves #896: you can now create links properly in Microsoft Edge. Our policy is now to check in periodically with new ckeditor releases and just make sure they are compatible with our editor skin before releasing them.
2282
2283* `apos.areas.fromRichText` can be used to create an area with a single rich text widget from a trusted string of HTML. Not intended for mixed media, just rich text. Related: both `fromRichText` and `fromPlaintext` now correctly give their widgets an `_id` property.
2284
2285## 2.26.1 (2017-06-12)
2286
2287All tests passing.
2288
2289* Fixed short-lived bug introduced in 2.26.0 re: detecting missing widget types.
2290
2291## 2.26.0 (2017-06-12)
2292
2293All tests passing.
2294
2295* Do not crash on missing widget types, print good warning messages.
2296
2297* Complete implementation of the [explicitOrder](http://apostrophecms.org/docs/modules/apostrophe-docs/server-apostrophe-cursor.html#explicit-order) cursor filter, replacing a nonfunctional implementation.
2298
2299* If the mongodb connection is lost, the default behavior is now to retry it forever, so when MongoDB does get restarted Apostrophe will find it. In addition, a `connect` object may be passed to the `apostrophe-db` module to be passed on to the MongoDB connect call.
2300
2301* Spaces added between DOM attributes for better HTML5 compliance.
2302
2303* `required` subfields are now enforced when editing fields of type `array`.
2304
2305Thanks to Michelin for their support of much of the work in this release.
2306
2307## 2.25.0 (2017-05-26)
2308
2309All tests passing.
2310
2311* There is now a `readOnly` option for the standard schema field types. Thanks to Michelin for contributing this feature.
2312
2313* Apostrophe now displays useful warnings and, in some cases, errors at startup when schemas are improperly configured. This is particularly useful if you have found it frustrating to configure joins correctly. We are continuing to deepen the coverage here.
2314
2315* In the manage view, the "published" and "trash" filters now always offer both "yes" and "no," regardless of whether anything is available in those categories. This is necessary because these are the respective defaults, and these are also unusual cases in which it is actually interesting to know nothing is available.
2316
2317## 2.24.0 (2017-05-05)
2318
2319All tests passing.
2320
2321There is now an `object` schema field type. It works much like the `array` schema field type, however there is just one object, represented as an object property of the doc in the database. Thanks to Michelin's development team for contributing this feature.
2322
2323## 2.23.2 (2017-04-30)
2324
2325All tests passing.
2326
2327The options object of `enhanceDate` is now passed on to `pikaday`. Considered a bug fix since the options object was erroneously ignored.
2328
2329* 2.23.1
2330
2331All tests passing.
2332
2333cleanCss needs to know that the output CSS files are going to live in apos-minified in order to correctly parse `@import` statements that pull in plain .css files. Also, the mechanism for prefixing URLs in CSS code was not applied at the correct stage of the bundling process (the minify stage), which broke the ability to reference fonts, images, etc. via URLs beginning with /modules when using an S3 asset bundle.
2334
2335## 2.23.0 (2017-04-24)
2336
2337All tests passing.
2338
2339* The "manage" view of `apostrophe-pieces` now supports robust filters, in the same way they were already supported on the front end for `apostrophe-pieces-pages`. Use the `addFilters` option to configure them. There is bc with existing filters that relied on the old assumption that manage filters have a boolean API. However now you can specify any field with a cursor filter, which includes most schema fields, notably including joins.
2340
2341Note that since all of the options are presented in a dropdown, not all fields are good candidates for this feature.
2342
2343The "manage" view filters now refresh to reflect only the options that still make sense based on the other filters you have selected, reducing user frustration.
2344
2345See [reusable content with pieces](http://apostrophecms.org/docs/tutorials/getting-started/reusable-content-with-pieces.html) for more information and examples.
2346
2347Thanks to Michelin for their support of this work.
2348
2349* `apos.utils.isFalse` allows you to check for values that are strictly `=== false` in templates.
2350
2351* `apos.utils.startCase` converts property names to English, roughly speaking. It is used as a fallback if a filter does not have a `label` property. This is primarily for bc, you should add a `label` property to your fields.
2352
2353* Production now matches the dev environment with regard to relative URLs in LESS files, such as those used to specify background images or font files. Previously the behavior was different in dev and production, which is a bug.
2354
2355* You can now pass a `less` option to `apostrophe-assets`, which is merged with the options given to `less.render` both in dev and production. You can use this, for instance, to enable `strictMath`.
2356
2357* `apostrophe.oembed`'s `fetch` method now propagates its `options` object to `oembetter` correctly. Thanks to Fotis Paraskevopoulos.
2358
2359## 2.22.0 (2017-04-11)
2360
2361All tests passing.
2362
2363* Apostrophe now supports publishing CSS and JS assets via S3 rather than serving them directly.
2364
2365Apostrophe already had an option to build asset "bundles" and deploy them at startup, as described in our [cloud HOWTO](http://apostrophecms.org/docs/tutorials/howtos/deploying-apostrophe-in-the-cloud.html). However this serves the assets from the cloud webserver, such as a Heroku dyno or EC2 instance. It is now possible to serve the assets from Amazon S3.
2366
2367See the [updated cloud HOWTO](http://apostrophecms.org/docs/tutorials/howtos/deploying-apostrophe-in-the-cloud.html) for details.
2368
2369Thanks to Michelin for their support of this work.
2370
2371* Enforce string field `min` and `max` properties on server side.
2372
2373* When validation of a form with tabs fails, such as a pieces edit modal, activate the correct tab and scroll to the first error in that tab.
2374
2375* thanks to Ludovic Bret for fixing a bug in the admin bar markup.
2376
2377## 2.21.0 (2017-04-11)
2378
2379All tests passing.
2380
2381* For a small performance boost, `defer` option can be set to `true` when configuring any widget module.
2382This defers calls to the `load` method until just before the page is rendered, allowing a single query
2383to fetch them all in simple cases. This is best applied
2384to the `apostrophe-images-widgets` module and similar widgets. It should not be applied if you wish
2385to access the results of the join in asynchronous code, because they are not available until the last
2386possible moment.
2387
2388Thanks to Michelin for their support of this work.
2389
2390* You can also set `deferImageLoading` to `true` for the `apostrophe-globals` module if you want the
2391same technique to be applied when loading the `global` doc's widgets. This does not always yield a
2392performance improvement.
2393
2394* Bug fix: if two crops of the same image were present in separate widgets on a page, only one of the crops would be seen in template code. This issue has been resolved.
2395
2396## 2.20.3 (2017-04-05)
2397
2398All tests passing.
2399
2400* The search filter is once again available when choosing images. This involved a deeper fix to modals: filters for sliding modals were not being properly captured and hoisted into the shared part of the outer div. This is now being done exactly as it is done for the controls (buttons) and the instructions.
2401
2402To avoid incompatibility with existing uses of `self.$filters`, such as in the manage modal, they are captured to `self.$modalFilters`. A small change to the manage modal was needed to take advantage of this.
2403
2404* Moved a warning message from `console.log` to `console.error`. `stdout` should never be used for warnings and errors. Moving toward clean output so that command line tasks can be safely used in pipelines.
2405
2406## 2.20.2 (2017-03-31)
2407
2408All tests passing.
2409
2410Improved UI for editing widgets. The edit button is no longer separate from the area-related controls such as up, down, etc. This reduces clutter and reduces difficulty in accessing widgets while editing.
2411
2412## 2.20.1 (2017-03-27)
2413
2414All tests passing.
2415
2416When autocompleting doc titles to add them to a join, Apostrophe again utilizes search result quality to display the best results first.
2417
2418## 2.20.0 (2017-03-20)
2419
2420All tests passing.
2421
2422This is a significant update with two useful new features and various minor improvements.
2423
2424* Support for batch uploads. The `apostrophe-images` and `apostrophe-files` modules now implement batch uploads by default.
2425
2426When you click "New File" or "New Image," you now go directly to the file browser, and if you select multiple files they are uploaded without a modal dialog appearing for each one; the title and slug are populated from the filename, and that's that.
2427
2428You can also drag one or more files directly to the chooser/manager modal.
2429
2430If you are choosing files or images for a widget, they are automatically selected after a batch upload.
2431
2432This feature can be disabled by setting the `insertViaUpload` option to `false` for `apostrophe-images` or `apostrophe-files`. If you are adding `required` fields to `apostrophe-images` or `apostrophe-files`, then batch uploading is not the best option for you because it would bypass that.
2433
2434**If you wish, you can enable the feature for your own `apostrophe-pieces` modules that have an `attachment` field in their schema by setting the `insertViaUpload` option to `true`.** However please note that this does not currently do anything for pieces that refer to an image or file indirectly via widget.
2435
2436* Global preference editing, and a standard UI to roll back to earlier versions of global content. There is now a "Global Content" admin bar button. By default, this launches the version rollback dialog box for shared global content.
2437
2438However, if you use `addFields` to add schema fields to the `apostrophe-global` module, this button instead launches an editing modal where you can edit those fields, and also offers a "Versions" button accessible from there.
2439
2440Global preferences set in this way are accessible in all situations where `data.global` is available. This is very useful for creating project-wide preference settings.
2441
2442All the usual features of schemas can be used, including `groupFields`. Of course, if you choose to use joins or widgets in global content, you should keep the performance impact in mind.
2443
2444* Various UX fixes to the manager and chooser modals.
2445
2446* If there is a `minSize` setting in play, that information is displayed to the user when choosing images.
2447
2448* The `checkboxes` schema field type now supports the `browseFilters` feature.
2449
2450* When batch file uploads fail, a more useful set of error messages are displayed.
2451
2452## 2.19.1 (2017-03-15)
2453
2454All tests passing.
2455
2456* When saving any doc with a schema, if an attachment field does not match a valid attachment that has actually been uploaded, that field is correctly nulled out. In addition, if the attachment's file extension is not in a valid fileGroup as configured via the attachments module, the field is nulled out. Finally, the `crop: true` option for attachments is saved successfully. This option allows for attachments to have a crop that is inherent to them, useful when there is no widget standing between the doc and the attachment.
2457
2458All of these changes correct bugs in intended behavior. Certain checks were present in the code but not completely functional. If you need to update your configuration to add file extensions, [apostrophe-attachments](http://apostrophecms.org/docs/modules/apostrophe-attachments/).
2459
2460## 2.19.0 (2017-03-15)
2461
2462All tests passing.
2463
2464* As always, Apostrophe always populates `req.data.home`; when `req.data.page._ancestors[0]` exists that is used, otherwise Apostrophe carries out a separate query. However as a performance enhancement, you may now disable this additional query by passing the `home: false` option to the `apostrophe-pages` module. Note that `req.data.home` is not guaranteed to exist if you do this.
2465
2466As for children of the home page, for performance you may now pass `home: { children: false }` option to the `apostrophe-pages` module. This option only comes into play when using `filters: { ancestors: false }`.
2467
2468Thanks to Michelin for their support of this work.
2469
2470## 2.18.2 (2017-03-10)
2471
2472All tests passing.
2473
2474* Performance enhancement: when fetching `req.data.home` directly in the absence of `req.data.page._ancestors[0]`, such as on the home page itself or a non-page route like `/login`, we must apply the same default filters before applying the filter options, namely `.areas(false).joins(false)`, otherwise duplicate queries are made.
2475
2476* Fixed bug in as-yet-unused `schemas.export` method caught by babel's linter.
2477
2478Thanks to Michelin for their support of this work.
2479
2480## 2.18.0 (2017-03-04)
2481
2482All tests passing.
2483
2484* New batch editing features for pieces! You can now use the checkboxes to select many items and then carry out the following operations in one step: trash, rescue from trash, publish, unpublish, tag and untag.
2485
2486In addition there is a clearly documented procedure for creating new batch editing features with a minimum of new code.
2487
2488* Several bugs in the array editor were fixed. Up, down and remove buttons work properly again, an aesthetic glitch was resolved and redundant ordinal numbers do not creep in when managing the order of an array without the `titleField` option.
2489
2490* Logging out completely destroys the session. While the standard behavior of `req.logout` in the Passport module is only to break the relationship between the `user` object and the session, users expect a clean break.
2491
2492## 2.17.2 (2017-02-28)
2493
2494All tests passing.
2495
2496* Members of a group that has the admin permission for a specific piece type can now move pieces of that type to and from the trash. (This was always intended, so this is a bug fix.)
2497* For better out-of-the-box SEO, an `alt` attribute with the title of the image is now part of the `img` markup of `apostrophe-images` widgets.
2498
2499## 2.17.1 (2017-02-21)
2500
2501All tests passing.
2502
2503* Fixed XSS (cross-site scripting) vulnerability in `req.browserCall` and `apos.push.browserCall`.
2504
2505* Removed confusing strikethrough of "Apply to Subpages" subform when the permission is being removed rather than added.
2506
2507* Improved UX of area widget controls.
2508
2509* Improved modal array tab UI and CSS.
2510
2511* The `oembedReady` Apostrophe event is now emitted correctly after `apostrophe-oembed` renders an oembed-based player, such as a YouTube video player for the `apostrophe-video` widget. This event can be listened for via `apos.on('apostrophe-oembed', fn)` and receives a jQuery object referring to the relevant element.
2512
2513## 2.17.0 (2017-02-14)
2514
2515All tests passing.
2516
2517* `array` schema fields now accept a `limit` option. They also support the `def` property to set defaults for individual fields. The array editor code has been refactored for better reliability and performance and documentation for the methods has been written.
2518
2519* Relative `@import` statements now work when you push plain `.css` files as Apostrophe assets. There is no change in behavior for LESS files. Thanks to Fredrik Ekelund.
2520
2521* Controls such as the "Finished" button of the reorganize modal were floating off the screen. This has been fixed.
2522
2523## 2.16.1 (2017-02-07)
2524
2525All tests passing.
2526
2527* If you have tried using `piecesFilters` with a `tags` field type, you may have noticed that when the query string parameter is present but empty, you get no results. This is suboptimal because that's a common result if you use an HTML form to drive the query. An empty string for a `tags` filter now correctly does nothing.
2528
2529* In `apostrophe-rich-text-widgets`, initialize CKEditor on `instanceReady`, rather than via a dodgy timeout. Thanks to Frederik Ekelund for finding a better way!
2530
2531## 2.16.0 (2017-02-03)
2532
2533All tests passing.
2534
2535* Reintroduced the reorganize feature for editors who have permissions for some pages but not others. You are able to see the pages you can edit and also their ancestors, in order to navigate the tree. However you are able to drag pages only to parents you can edit.
2536
2537* Introduced the new `deleteFromTrash` option to the `apostrophe-pages` module. If this option is enabled, a new icon appears in "reorganize" when looking at pages in the trash. This icon allows you to permanently delete a page and its descendants from the site.
2538
2539The use of this option can lead to unhappy customers if they do not clearly understand it is a permanent action. For that reason, it is disabled by default. However it can be quite useful when transitioning from the initial site build to long-term support. We recommend enabling it during that period and disabling it again after cleanup.
2540
2541* "Reorganize" no longer displays nonfunctional "view" and "trash" icons for the trash and pages inside it.
2542
2543* The tests for the `apostrophe-locks` module are now deterministic and should always pass.
2544
2545## 2.15.2 (2017-01-30)
2546
2547All tests passing.
2548
2549Fixed a bug which could cause a crash if the `sort` filter was explicitly set to `search` and no search was actually present. Conditions existed in which this could happen with the autocomplete route.
2550
2551## 2.15.1 (2017-01-23)
2552
2553Due to a miscommunication the version number 2.15.0 had been previously used. The description below was originally intended for 2.15.0 and has been published as 2.15.1 purely to address the version numbering conflict.
2554
2555All tests passing.
2556
2557* `apos.permissions.addPublic` accepts multiple arguments and array arguments,
2558adding all of the permission names given including any listed in the arrays.
2559* Permissions checks for pieces admin routes longer check for req.user, checking for the appropriate `edit-` permission is sufficient and makes addPublic more useful.
2560* Updated the `i18n` module to address a problem where labels that happened to be numbers rather than strings would crash the template if passed to `__()`.
2561* Documentation improvements.
2562
2563## 2.14.3
2564
2565All tests passing.
2566
2567The mechanism that preserves text fields when performing AJAX refreshes was preserving
2568other types of `input` elements. Checkboxes, radio buttons and `type="submit"` are now
2569properly excluded from this mechanism.
2570
2571## 2.14.2 (2017-01-18)
2572
2573Fixed [#385](https://github.com/punkave/apostrophe/issues/385): if a page is moved to the trash, its slug must always change, even if it has been edited so that it no longer has its parent's slug as a prefix. In addition, if the resulting slug of a descendant of the page moving to the trash conflicts with an existing page in the trash, steps are taken to ensure uniqueness.
2574
2575## 2.14.1 (2017-01-11)
2576
2577All tests passing.
2578
2579* The `apos.utils.clonePermanent` method no longer turns objects into long arrays of nulls if they happen to have a `length` property. `lodash` uses the `length` property as an indicator that the object should be treated as an array, but this would be an unrealistic restriction on Apostrophe schema field names. Instead, `clonePermanent` now uses `Array.isArray` to distinguish true arrays. This fixes a nasty bug when importing content from A1.5 and subsequently editing it.
2580
2581* When a user is logged in there is an `apos.user` object on the browser side. Due to a bug this was an empty object. It now contains `title`, `_id` and `username` properties as intended.
2582
2583## 2.14.0 (2017-01-06)
2584
2585All tests passing.
2586
2587* A version rollback dialog box for the `global` doc is now opened if an element with the `data-apos-versions-global` attribute is clicked. There is currently no such element in the standard UI but you may introduce one in your own layout if you have mission-critical content in the `global` doc that is awkward to recreate after an accidental deletion, such as a custom sitewide nav.
2588* An error message is correctly displayed when login fails.
2589* Many UI messages are now passed through the `__()` internationalization helper correctly. Thanks to `timaebi`.
2590
2591## 2.13.2 (2016-12-22)
2592
2593All tests passing.
2594
2595The `data-apos-ajax-context` feature had a bug which prevented ordinary anchor links from performing AJAX refreshes correctly.
2596
2597## 2.13.1 (2016-12-22)
2598
2599All tests passing.
2600
2601The `apostrophe-attachments` module now calls `apos.ui.busy` correctly on the fieldset so that the busy and completed indicators are correctly shown and hidden. Previously the string `0` was passed, which is not falsy.
2602
2603## 2.12.0 (2016-12-15)
2604
2605All tests passing.
2606
2607* Developers are no longer required to set `instantiate: false` in `app.js` when configuring an npm module that uses the `improve` property to implicitly subclass and enhance a different module. In addition, bugs were fixed in the underlying `moog-require` module to ensure that assets can be loaded from the `public` and `views` folders of modules that use `improve`.
2608* `string` has replaced `csv` as the property name of the schema field converters that handle plaintext. Backwards compatibility has been implemented so that existing `csv` converters will work transparently and calls to `convert` with `csv` as the `from` argument still work as well. In all new custom field types you should say `string` rather than `csv`. There is no change in the functionality or implementation other than the name.
2609
2610## 2.11.0 (2016-12-09)
2611
2612All tests passing.
2613
2614You can now add middleware to your Apostrophe site via any module in your project. Just add an `self.expressMiddleware` method to your module, which takes the usual `req, res, next` arguments. Or, if it's more convenient, set `self.expressMiddleware` to an array of such functions. "Module middleware" is added immediately after the minimum required Apostrophe middleware (bodyParser, `req.data`, etc), and before any routes.
2615
2616## 2.10.3 (2016-12-08)
2617
2618All tests passing.
2619
2620Fixed bug in `autoPreserveText` feature of our `data-apos-ajax-context` mechanism; also, restricted it to text inputs and textareas that actually have the focus so that you can replace their values normally at other times
2621
2622## 2.10.2 (2016-12-06)
2623
2624All tests passing.
2625
2626A very minor fix, but 2.10.1 had a very noisy console.log statement left in.
2627
2628## 2.10.1 (2016-12-06)
2629
2630All tests passing.
2631
2632* The built-in cursor filters for `float` and `integer` no longer incorrectly default to filtering for docs with the value `0` if the value being filtered for is undefined or null. They default to not filtering at all, which is correct.
2633
2634## 2.10.0 (2016-12-06)
2635
2636All tests passing.
2637
2638* Apostrophe now automatically recompiles modified Nunjucks templates. This means you can hit refresh in your browser after hitting save in your editor when working on `.html` files. Also note that this has always worked for `.less` files.
2639* Fixed a longstanding bug in `joinByArrayReverse`, which now works properly.
2640
2641## 2.9.2 (2016-12-02)
2642
2643All tests passing.
2644
2645* Starting with MongoDB 3.3.x (?), it is an error to pass `safe: true` when calling `ensureIndex`, and it has never done anything in any version. In our defense, cargo-cult practice was probably adopted back in the days when MongoDB would invoke your write callback without actually confirming anything unless you passed `safe: true`, but apparently this was never a thing for indexes. Removed all the `safe: true` arguments from `ensureIndex` calls.
2646* Added a `beforeAjax` Apostrophe event to facilitate progress display and animations when using the new `data-apos-ajax-content` feature.
2647
2648## 2.9.1 (2016-12-02)
2649
2650All tests passing.
2651
2652* Fixed an omission that prevented the use of the back button to undo the very first click when using the new `data-apos-ajax-context`. Later clicks worked just fine, but for the first one to work we need a call to `replaceState` to make it possible to restore the original query.
2653
2654## 2.9.0 (2016-12-01)
2655
2656All tests passing.
2657
2658* Two major new features in this release: built-in filters for most schema fields, and built-in AJAX support for `apostrophe-pieces-pages`. These combine to eliminate the need for custom code in a wide array of situations where you wish to allow users to browse and filter blog posts, events, etc. In most cases there is no longer any need to write your own `cursor.js` or your own AJAX implementation. The provided AJAX implementation handles browser history operations, bookmarking and sharing properly and is SEO-friendly.
2659
2660[See the official summary of the pull request for details and examples of usage.](https://github.com/punkave/apostrophe/pull/766)
2661
2662* We also fixed a bug in the `refinalize` feature of cursors. state.criteria is now cloned before finalize and restored after it. Otherwise many criteria are added twice after refinalize which causes a fatal error with a few, like text search in mongodb.
2663
2664In addition, we merged a contribution from Fotis Paraskevopoulos that allows a `bodyParser` option with `json` and `urlencoded` properties to be passed to the `apostrophe-express` module. Those properties are passed on to configure those two body parser middleware functions.
2665
2666## 2.8.0 (2016-11-28)
2667
2668All tests passing.
2669
2670* `APOS_MONGODB_URI` environment variable is used to connect to MongoDB if present. Helpful for cloud hosting. See the new [deploying Apostrophe in the cloud HOWTO](http://apostrophecms.org/docs/tutorials/howtos/deploying-apostrophe-in-the-cloud.html).
2671* `APOS_S3_BUCKET`, `APOS_S3_ENDPOINT` (optional), `APOS_S3_SECRET`, `APOS_S3_KEY`, and `APOS_S3_REGION` environment variables can be used to configure Apostrophe to use S3 for uploaded media storage. This behavior kicks in if `APOS_S3_BUCKET` is set. See the new [deploying Apostrophe in the cloud HOWTO](http://apostrophecms.org/docs/tutorials/howtos/deploying-apostrophe-in-the-cloud.html).
2672* New advisory locking API accessible via `apos.locks.lock` and `apos.locks.unlock`. `apostrophe-migrations:migrate` is now wrapped in a lock. More locks are coming, although Apostrophe was carefully designed for benign worst case outcomes during race conditions.
2673* Better asset deployment for Heroku and other cloud services. `node app apostrophe:generation --create-bundle=NAME` now creates a new folder, `NAME`, containing assets that would otherwise have been written to `public`. Launching a server with the `APOS_BUNDLE` environment variable set to `NAME` will then copy that bundle's contents into `public` before listening for connections. See the new [deploying Apostrophe in the cloud HOWTO](http://apostrophecms.org/docs/tutorials/howtos/deploying-apostrophe-in-the-cloud.html).
2674* `apostrophe-pieces-pages` index pages are about 2x faster; discovered we were inefficiently deep-cloning `req` when cloning a cursor.
2675* Helpful error message if you forget to set the `name` property of one of your `types` when configuring `apostrophe-pages`.
2676
2677## 2.7.0 (2016-11-16)
2678
2679* We do a better job of defaulting to a sort by search match quality if full-text search is present in a query. Under the hood this is powered by the new `defaultSort` filter, which just stores a default value for the `sort` filter to be used only if `search` (and anything else with an implicit preferred sort order) is not present. No more lame search results for blog posts. You can explicitly set the `sort()` filter in a cursor override if you really want to, but trust us, when `search` is present sorting by anything but search quality produces poor results.
2680* Fixed bugs in the sanitizer for page slugs. It is now impossible to save a slug with trailing or consecutive slashes (except the home page slug which is allowed to consist of a single "trailing" slash). Added unit tests.
2681* Apostrophe's dropdown menus, etc. will more robustly maintain their font size in the presence of project-level CSS. There is an explicit default font size for `.apos-ui`.
2682
2683## 2.6.2 (2016-11-12)
2684
2685All tests passing.
2686
2687* The auto-suggestion of titles upon uploading files also suggests slugs.
2688* The auto-suggestion of titles and slugs applies to both "files" and "images."
2689* Reduce the clutter in the versions collection by checking for meaningful change on the server side, where final sanitization of HTML, etc. has taken place to iron out distinctions without a difference.
2690* Use the permission name `edit-attachment` consistently, so that calling `addPublic('edit-attachment')` has the intended effect.
2691* Manage view of pieces does not crash if `updatedAt` is missing from a piece.
2692
2693## 2.6.1 (2016-11-08)
2694
2695All tests passing.
2696
2697* Choosers and schema arrays play nicely with the new fixed-position tabs.
2698* Better CSS solution to positioning the attachment upload buttons which doesn't interfere with other styles.
2699* Images in the chooser choices column "stay in their lane."
2700* Better error message when an attempt to edit an area with a hyphenated name is used.
2701* Array edit button fixed.
2702* The `type()` cursor filter now has a finalizer and merges its criteria there at the very end, so that you can override a previous call to it at any time prior to invoking `toArray` or similar.
2703* Area controls no longer interfere with visibility of widget type selection menu.
2704
2705## 2.6.0 (2016-11-04)
2706
2707All tests passing.
2708
2709* `relationship` fields defined for `joinByArray` can now have an `inline: true` flag. If they are inline, they are presented right in the chooser, rather than appearing in a separate modal dialog reachable by clicking an icon. This feature should be used sparingly, but that's true of relationship fields in general.
2710* Permissions editing for pages now takes advantage of the new inline relationship fields to make the "apply to subpages" functionality easier to discover.
2711* When uploading files or images, the title field is automatically suggested based on the filename.
2712* Improvements in form field UX and design.
2713* When choosing pieces (including images), if you elect to create a new piece it is automatically added to the selection.
2714* When choosing pieces, if the `limit` is reached and it is greater than 1, a helpful message appears, and the UI changes to make clear that you cannot add items until you remove one. If the limit is exactly 1, a new selection automatically replaces the current selection, and singular language is used to clarify what is happening.
2715* Syntax errors in "related types" such as cursors now produce an improved error message with filename and line number.
2716* Showstopper errors during startup are reported in a less redundant way.
2717
2718## 2.5.2 (2016-11-01)
2719
2720All tests passing.
2721
2722* New `blockLevelControls: true` option to areas ensures controls for "blocks," i.e. "layout" widgets whose primary purpose is to contain other widgets, can be easily distinguished from controls for "regular" areas nested inside them. Think of a "two-column" or "three-column" widget with three areas in its template. The controls for these areas are displayed in a distinct color and various visual affordances are made to ensure they are accessible when things would otherwise be tightly spaces.
2723* General improvements to the usability of area-related controls.
2724* The search index now correctly includes the text of string and select schema fields found in widgets, pieces, pages, etc., as it always did before in 0.5. You may use `searchable: false` to disable this on a per-field basis.
2725* Search indexing has been refactored for clarity (no changes to working APIs).
2726* Checkboxes for the `checkboxes` schema field type are now styled.
2727* "View file" links in the file library are now styled as buttons.
2728
2729## 2.5.1 (2016-10-28)
2730
2731All tests passing.
2732
2733* The `minSize` option to `apostrophe-images` widgets now works properly when cropping.
2734* The cropper no longer starts out cropping to the entire image, as this made it unclear what was happening. However if you click the crop button and then just save you still get reasonable behavior.
2735* Bigger crop handles.
2736* Textarea focus state receives the same "glow" as a regular text input field.
2737* Small documentation updates.
2738
2739## 2.5.0 (2016-10-21)
2740
2741All tests passing.
2742
2743* Implemented `apos.areas.fromPlaintext`, which accepts a string of plaintext (not markup) and returns an area with a single `apostrophe-rich-text` widget in it, containing that text. Useful in implementing importers.
2744* The so-called `csv` import mode of `apos.schemas.convert` works properly for areas, using the above. Although it is called csv this mode is really suitable for any situation in which you have plaintext representations of each property in an object and would like those sanitized and converted to populate a doc.
2745* Bug fix: emit the `enhance` Apostrophe event only once on page load. This event is emitted only when there is new content that has been added to the page, e.g. once at page load, and also when a new widget is added or updated, etc. The first argument to your event handler will be a jQuery element which will contain only new elements.
2746* Legacy support for `data/port` and `data/address` files has been restored. (Note that `PORT` and `ADDRESS` environment variables supersede these. In modern Stagecoach deployments `data/port` is often a space-separated list of ports, and the `deployment/start` script parses these out and launches multiple processes with different PORT variables.)
2747
2748## 2.4.0 (2016-10-19)
2749
2750All tests passing.
2751
2752Workarounds for two limitations in MongoDB that impact the use of Apostrophe cursors:
2753
2754* The `addLateCriteria` cursor filter has been introduced. This filter should be used only when
2755you need to invoke `$near` or another MongoDB operator that cannot be used within `$and`. The object
2756you pass to `addLateCriteria` is merged with the criteria object that is built normally by the cursor.
2757**Use of this filter is strongly discouraged unless you must use operators that do
2758not support `$and`.**
2759* Custom filters that invoke `$near` or other MongoDB operators that are incompatible
2760with `$text` queries may call `self.set('regexSearch', true)` to force the cursor to use
2761a regular expression search rather than full MongoDB full-text search, if and when the
2762`search()` filter is called on the same cursor. This was implemented to allow combination
2763of full-text and geographical searches, subject of course to the limitation that regular expression
2764search is not indexed. It also doesn't sort by quality, but `$near` provides its own sort
2765by distance.
2766
2767Since these are new features a minor version level bump is appropriate. However neither of these is a feature that a typical site developer will need to call directly.
2768
2769## 2.3.2 (2016-10-17)
2770
2771All tests passing.
2772
2773* The quality of the autocomplete search results shown when selecting pages or pieces via a join was low. This has been corrected by calling the `.sort('search')` filter to sort by search result quality rather than the default sort order for the doc type manager in question.
2774* All of the autocomplete suggestions fit on the screen on reasonably sized displays. With the recent addition of the "flip" feature to push the suggestions up rather than down if the bottom of the screen would otherwise be reached, this is critical to show the first and best suggestion. Further discussion for future UX improvement in [issue 704](https://github.com/punkave/apostrophe/issues/704).
2775
2776## 2.3.1 (2016-10-13)
2777
2778All tests passing.
2779
2780* Fixed a bug in the new "copy page" feature that affects pages that have `null` properties.
2781* Improved the experience of using the widget controls to manage the widgets in an area.
2782* The `login` module now has an alias, `apos.login`, like other core modules.
2783* Updated the jquery projector plugin to the latest version.
2784
2785## 2.3.0 (2016-10-06)
2786
2787All tests passing.
2788
2789* Fixed a bug affecting the use of `arrangeFields` in modules that extend another module's use of `arrangeFields`. Added unit test based directly on a real-world project.
2790* `baseUrl` project-wide option added, yielding the same benefit as in 0.5: you get absolute URLs for all pages everywhere. (If you don't want absolute URLs, just don't set it.) This is very beneficial when generating `og:meta` tags for Facebook, or generating emails.
2791* A direct link to the original file has been added to the file manager's editor modal.
2792
2793## 2.2.2 (2016-10-05)
2794
2795All tests passing.
2796
2797* Addition of slugs to projection for autocomplete is now done in a way that still allows overrides at the doc level to add other properties.
2798* Addition of slugs to projection for autocomplete works for joins with a specific page type, too.
2799* Fixed a chicken-and-egg problem in the global module that kicked in if the "global" doc contains widgets powered by modules not yet initialized at the time the global module checks for the existence of the doc.
2800
2801## 2.2.1 (2016-10-04)
2802
2803All tests passing.
2804
2805Fixed an oversight: the new `pageBeforeCopy` global method now takes `req` as its first parameter. Since `2.2.0` was first published 5 minutes ago and this method has not yet been documented this is not regarded as a bc break.
2806
2807## 2.2.0 (2016-10-04)
2808
2809All tests passing.
2810
2811* Fixed bug that broke removal of permissions for pages.
2812* "Copy Page" feature added to the page menu.
2813* Automatically reposition the autocomplete dropdown for joins if it would collide with the bottom of the window.
2814* Include page slugs in the autocomplete dropdown for joins with pages.
2815* `chooserChoiceBase.html` restored; some projects were depending on extending it, which is a useful technique.
2816
2817## 2.1.5 (2016-10-01)
2818
2819All tests passing.
2820
2821* Admin bar: previously grouped fields can be re-grouped successfully, so concatenating admin bar configuration works just as well as concatenating `addFields` arrays
2822* Files widget displays upload button in the same user-friendly position as the images widget
2823* Font size for tabs and help labels is explicit to avoid side effects from project-level CSS
2824
2825## 2.1.4 (2016-09-23)
2826
2827All tests passing.
2828
2829* Previously chosen items that now reside in the trash no longer break the chooser for editing joins
2830* All joins editable; certain edge cases weren't getting blessed
2831* A field appears properly when two diferent choices list it for `showFields`
2832* As in 0.5, a required field hidden by `showFields` is not required (but will be if you elect the choice that shows it)
2833
2834## 2.1.3 (2016-09-20)
2835
2836All tests passing.
2837
2838* A typo in the unit tests caused unit tests to fail. This has been fixed.
2839* The recent addition of the HTML5 doctype caused the login page to be invisible in the sandbox project (not the boilerplate project). This has been fixed.
2840* The recent addition of the HTML5 doctype caused the admin bar to appear with a slight visual defect. This has been fixed.
2841
2842## 2.1.2 (2016-09-19)
2843
2844Fix for [#668](https://github.com/punkave/apostrophe/issues/668), crash occurring when admin bar group leader starts out too close to the end of the admin bar items array.
2845
2846## 2.1.1 (2016-09-18)
2847
2848Full Windows compatibility restored. The "recursively copy asset folders if on Windows" behavior from 0.5 was reimplemented. This is necessary to allow Apostrophe to run as a non-administrator on Windows. Running as administrator is the moral equivalent of running as root on Linux, which we would never recommend.
2849
2850Since Apostrophe did not function previously on Windows and there is no behavior change on Mac/Linux this is effectively a bug fix rather than a new feature, thus 2.1.1.
2851
2852## 2.1.0 (2016-09-16)
2853
2854* Introduced the new `apos.areas.richText` and `apos.areas.plaintext` methods, which are also available in templates by the same names.
2855
2856* Added and documented the `addImageSizes` option of the `apostrophe-attachments` module.
2857
2858## 2.0.4 (2016-09-14)
2859
2860* The `apostrophe-login` module now invokes `loginAfterLogin(req, callback)` on all modules that have such a method, via `apos.callAll`. Modules that do not need a callback can supply this method with only one argument. Afterwards, `apostrophe-login` redirects to `req.redirect`, as is supported elsewhere in Apostrophe. So you can assign to `req.redirect` in your callback to change the user's destination after a successful login. If `req.redirect` is not set, the user is redirected to the home page.
2861
2862## 2.0.3 (2016-09-13)
2863
2864The `ancestors` and `children` filters defaulted to `areas(false)`, but `joins(false)` was omitted, contrary to documentation which has always indicated the information returned is limited for performance. This was fixed. You can still override freely with the `filters` option to `apostrophe-pages`.
2865
2866The HTML5 doctype was added to `outerLayoutBase`. HTML5 was always assumed, and the absence of the doctype broke jQuery's support for distinguishing `$(window).height()` from `$(document).height()`, causing runaway infinite scroll loading.
2867
2868Warning message instructions for configuring the session secret were fixed (the actual location has not changed).
2869
2870## 2.0.2 (2016-09-08)
2871
2872Previously the `contextual` flag of a pieces module was not considered before deciding to redirect to the "show page" for the piece, which might not exist. This has been fixed. It should only happen when the module has `contextual: true`, creating a reasonable expectation that such a page must exist.
2873
2874## 2.0.1 (2016-09-05)
2875
2876Packaging and documentation issues only.
2877
2878## 2.0.0 (2016-09-03)
2879
2880Inaugural npm release of Apostrophe 2.x, which was used prior to that in many projects via git dependencies.