[9.11.8] Problem with Turn On Notification when notifications.emails.enabled = false

Hi,

Version 9.11.8. When in xwiki.properties I set notifications.emails.enabled = false then I can’not Turn On/Off notifications in my profile. I get error:

HTTP Status 500 - org.apache.velocity.exception.MethodInvocationException: Invocation of method ‘saveNotificationPreferences’ in class org.xwiki.notifications.preferences.script.NotificationPreferenceScriptService threw exception org.xwiki.notifications.NotificationException: Failed to save preferences for notifications given as JSON. at 46:xwiki:XWiki.Notifications.Code.NotificationPreferenceService[line 25, column 36]

I check JSON and see that instead boolean true or false in email section strange value:

{“eventType”:“BlogPostPublishedEvent”,“format”:“alert”,“enabled”:false},

{“eventType”:“BlogPostPublishedEvent”,“format”:“email”,“enabled”:
{“length”:0,“prevObject”:{“length”:0,“prevObject”:{“0”:
{“jQuery222012375129411509441”:{“olddisplay”:“table-row”}},“context”:
{“jQuery222012375129411509441”:{“olddisplay”:“table-row”}},“length”:1},“context”:
{“jQuery222012375129411509441”:{“olddisplay”:“table-row”}},“selector”:".notificationTypeCell[data-format=“email”]"},“context”:
{“jQuery222012375129411509441”:{“olddisplay”:“table-row”}},“selector”:".notificationTypeCell[data-format=“email”] .notificationTypeCheckbox"}},

Hi.

Could you paste the whole error message returned with the 500 status?

Hi, full log here (39.1 KB)

Thanks. Indeed the JSON you pasted is very odd. I’ll try to reproduce.

Bug is confirmed. I have created the following issue and I am currently fixing it:
https://jira.xwiki.org/browse/XWIKI-15886

Fixed. To fix your wiki, you need to import the following xar in your wiki:
https://jira.xwiki.org/secure/attachment/36181/xwiki-platform-notifications-ui-9.11.9-SNAPSHOT.xar

See documentation if you don’t know how to do it:
https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/ImportExport

1 Like

With tests? :slight_smile:

I haven’t checked but we’ve had lots of bugs and regressions in the notifications feature in the past and I was wondering if we have a strong test suite for it? It seems it might be needed, seen it’s a complex topic.