It applies the fix proposed above: fail() instead of the removed jqXHR.error(), the second change of the combined options chained with then() in a performChainedChanges() helper instead of an already started request handed to pipe(), and truthy guards instead of the comparisons against the string 'undefined'.
Verified two ways:
With jQuery 4.0.0 and jQuery Migrate 4.0.2, the versions the platform ships, running the old and the new handler side by side against a real HTTP server. Before: TypeError: chain.error is not a function, both requests sent at the same millisecond, and the page reload firing at 37 ms while the space-level request only completed at 161 ms. After: no exception, the space-level request sent only once the page-level one had completed, the reload firing after both, and no JQMIGRATE message left. jqXHR.error and jqXHR.success are indeed undefined in that combination, while fail and done are functions.
mvn clean verify -pl xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-test/xwiki-platform-notifications-test-docker -Plegacy,docker,integration-tests -Dit.test=NotificationsSettingsIT, which covers the watch modal including the UNWATCH_PAGE_WATCH_SPACE combined option: 5 tests out of 6 pass. The 6th, watchAndRename:874, fails identically on unmodified master in the same environment (HSQLDB embedded, Jetty standalone, Firefox on macOS) – I ran the class twice, once with the fix and once with the master version of the file put back – so it is pre-existing and unrelated: that test never opens the watch modal.
The failure path itself (a request that does not succeed) has no automated test.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.