Steps to reproduce
- Create a page containing {{{ notifications useUserPreferences="true" / }}}
- View that page as guest (or as a user who has no notification preference enabled)
Expected The macro displays no notification. Actual The asynchronous rendering of the notifications fails, and the following error is logged:
Analysis QueryExpressionGenerator#generateQueryExpression returns null when the notification parameters have no preference (which is the case for the guest user with useUserPreferences=true, since no preference can be loaded without a user), meaning that no event can match. EventQueryGenerator#generateQuery passes this null expression to ExpressionNodeToEventQueryConverter#parse, which throws. Before XWIKI-19826 the exception of the event store was caught and the search fell back on the legacy event stream, which returned an empty list for a null query. Since the fallback was removed, the case is not handled anymore. Found in the logs of NotificationsIT#compositeNotifications on CI (the test ends on a page with the notifications macro using the user preferences, and its tear down removes the users). |