From 190bfffdc3ace288704f8f122580f8d3d7f5957c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 12 Mar 2011 08:43:45 +0100 Subject: [PATCH] Add possibility to unbookmark all not loaded posts at once. --- .../java/net/pterodactylus/sone/web/UnbookmarkPage.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/UnbookmarkPage.java b/src/main/java/net/pterodactylus/sone/web/UnbookmarkPage.java index 85a0359..85f46f0 100644 --- a/src/main/java/net/pterodactylus/sone/web/UnbookmarkPage.java +++ b/src/main/java/net/pterodactylus/sone/web/UnbookmarkPage.java @@ -17,6 +17,9 @@ package net.pterodactylus.sone.web; +import java.util.Set; + +import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.web.page.Page.Request.Method; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -54,6 +57,16 @@ public class UnbookmarkPage extends SoneTemplatePage { webInterface.getCore().unbookmarkPost(id); throw new RedirectException(returnPage); } + String id = request.getHttpRequest().getParam("post"); + if (id.equals("allNotLoaded")) { + Set posts = webInterface.getCore().getBookmarkedPosts(); + for (Post post : posts) { + if (post.getSone() == null) { + webInterface.getCore().unbookmark(post); + } + } + throw new RedirectException("bookmarks.html"); + } } } -- 2.7.4