/*
- * Sone - EditImageAjaxPage.java - Copyright © 2011–2013 David Roden
+ * Sone - EditImageAjaxPage.java - Copyright © 2011–2016 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
return createSuccessJsonObject().put("sourceImageId", image.getId()).put("destinationImageId", swappedImage.getId());
}
String title = request.getHttpRequest().getParam("title").trim();
+ if (title.isEmpty()) {
+ return createErrorJsonObject("invalid-image-title");
+ }
String description = request.getHttpRequest().getParam("description").trim();
- image.setTitle(title).setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description));
+ image.modify().setTitle(title).setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description)).update();
webInterface.getCore().touchConfiguration();
return createSuccessJsonObject().put("imageId", image.getId()).put("title", image.getTitle()).put("description", image.getDescription()).put("parsedDescription", (String) parserFilter.format(new TemplateContext(), image.getDescription(), ImmutableMap.<String, Object>builder().put("sone", image.getSone()).build()));
}