- private JsonObject createJsonNotification(Notification notification) {
- JsonObject jsonNotification = new JsonObject();
- jsonNotification.put("id", notification.getId());
- StringWriter notificationWriter = new StringWriter();
- try {
- if (notification instanceof TemplateNotification) {
- TemplateContext templateContext = webInterface.getTemplateContextFactory().createTemplateContext().mergeContext(((TemplateNotification) notification).getTemplateContext());
- templateContext.set("notification", notification);
- ((TemplateNotification) notification).render(templateContext, notificationWriter);
- } else {
- notification.render(notificationWriter);
- }
- } catch (IOException ioe1) {
- /* StringWriter never throws, ignore. */
+ private static JsonNode createJsonOptions(Sone currentSone) {
+ ObjectNode options = new ObjectNode(instance);
+ if (currentSone != null) {
+ options.put("ShowNotification/NewSones", currentSone.getOptions().isShowNewSoneNotifications());
+ options.put("ShowNotification/NewPosts", currentSone.getOptions().isShowNewPostNotifications());
+ options.put("ShowNotification/NewReplies", currentSone.getOptions().isShowNewReplyNotifications());