From: David ‘Bombe’ Roden Date: Sat, 12 Mar 2011 07:43:45 +0000 (+0100) Subject: Add possibility to unbookmark all not loaded posts at once. X-Git-Tag: 0.5.1^2~3 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=190bfffdc3ace288704f8f122580f8d3d7f5957c;p=Sone.git Add possibility to unbookmark all not loaded posts at once. --- 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"); + } } }