Don’t get the current Sone, we allow to modify local Sones only.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / EditAlbumPage.java
index d028f8d..3db14d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - EditAlbumPage.java - Copyright © 2011–2012 David Roden
+ * Sone - EditAlbumPage.java - Copyright © 2011–2013 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,30 +51,19 @@ public class EditAlbumPage extends SoneTemplatePage {
        protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
                super.processTemplate(request, templateContext);
                if (request.getMethod() == Method.POST) {
-                       Sone currentSone = getCurrentSone(request.getToadletContext());
                        String albumId = request.getHttpRequest().getPartAsStringFailsafe("album", 36);
                        Album album = webInterface.getCore().getAlbum(albumId, false);
                        if (album == null) {
                                throw new RedirectException("invalid.html");
                        }
-                       if (!webInterface.getCore().isLocalSone(album.getSone())) {
+                       if (!album.getSone().isLocal()) {
                                throw new RedirectException("noPermission.html");
                        }
                        if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("moveLeft", 4))) {
-                               if (album.getParent() == null) {
-                                       currentSone.moveAlbumUp(album);
-                                       webInterface.getCore().touchConfiguration();
-                                       throw new RedirectException("imageBrowser.html?sone=" + currentSone.getId());
-                               }
                                album.getParent().moveAlbumUp(album);
                                webInterface.getCore().touchConfiguration();
                                throw new RedirectException("imageBrowser.html?album=" + album.getParent().getId());
                        } else if ("true".equals(request.getHttpRequest().getPartAsStringFailsafe("moveRight", 4))) {
-                               if (album.getParent() == null) {
-                                       currentSone.moveAlbumDown(album);
-                                       webInterface.getCore().touchConfiguration();
-                                       throw new RedirectException("imageBrowser.html?sone=" + currentSone.getId());
-                               }
                                album.getParent().moveAlbumDown(album);
                                webInterface.getCore().touchConfiguration();
                                throw new RedirectException("imageBrowser.html?album=" + album.getParent().getId());