import java.io.IOException;
import java.io.StringWriter;
-import java.util.ArrayList;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Reply;
protected JsonObject createJsonObject(Request request) {
String[] notificationIds = request.getHttpRequest().getParam("notifications").split(",");
JsonObject jsonNotifications = new JsonObject();
- Sone currentSone = webInterface.getCurrentSone(request.getToadletContext(), false);
+ Sone currentSone = getCurrentSone(request.getToadletContext(), false);
for (String notificationId : notificationIds) {
Notification notification = webInterface.getNotifications().getNotification(notificationId);
- ListNotificationFilters.filterNotifications(new ArrayList<Notification>(), currentSone);
if ("new-post-notification".equals(notificationId)) {
- notification = ListNotificationFilters.filterNewPostNotification((ListNotification<Post>) notification, currentSone);
+ notification = ListNotificationFilters.filterNewPostNotification((ListNotification<Post>) notification, currentSone, false);
} else if ("new-reply-notification".equals(notificationId)) {
notification = ListNotificationFilters.filterNewReplyNotification((ListNotification<Reply>) notification, currentSone);
+ } else if ("mention-notification".equals(notificationId)) {
+ notification = ListNotificationFilters.filterNewPostNotification((ListNotification<Post>) notification, currentSone, false);
}
if (notification == null) {
// TODO - show error
try {
if (notification instanceof TemplateNotification) {
TemplateContext templateContext = webInterface.getTemplateContextFactory().createTemplateContext().mergeContext(((TemplateNotification) notification).getTemplateContext());
+ templateContext.set("core", webInterface.getCore());
templateContext.set("currentSone", webInterface.getCurrentSone(request.getToadletContext(), false));
templateContext.set("localSones", webInterface.getCore().getLocalSones());
templateContext.set("request", request);