aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-11 14:05:43 +0300
committerGravatar Vitaly Takmazov2018-04-11 14:05:43 +0300
commitf7a2f1440ef0c13a472b1b815186615d2c54168a (patch)
tree2270b2bd9948cdb809e40942b63cf4c84172a53a /juick-common/src/main/java/com/juick/server/CommandsManager.java
parent6f346454e906d07551c35a7173fd8175b4d0975d (diff)
server: ImagesService refactoring
Diffstat (limited to 'juick-common/src/main/java/com/juick/server/CommandsManager.java')
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/juick-common/src/main/java/com/juick/server/CommandsManager.java b/juick-common/src/main/java/com/juick/server/CommandsManager.java
index 8dbe99e3..d924ac70 100644
--- a/juick-common/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java
@@ -74,6 +74,8 @@ public class CommandsManager {
private String imgDir;
@Inject
private ApplicationEventPublisher applicationEventPublisher;
+ @Inject
+ private ImagesService imagesService;
public CommandResult processCommand(User user, String input, @Nonnull URI attachment) throws Exception {
Optional<Method> cmd = MethodUtils.getMethodsListWithAnnotation(getClass(), UserCommand.class).stream()
@@ -105,7 +107,7 @@ public class CommandsManager {
String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost()
: HttpUtils.downloadImage(attachment.toURL(), tmpDir).getHost();
String fname = String.format("%d.%s", mid, attachmentType);
- ImageUtils.saveImageWithPreviews(attachmentFName, fname, tmpDir, imgDir);
+ imagesService.saveImageWithPreviews(attachmentFName, fname);
}
com.juick.Message msg = messagesService.getMessage(mid);
applicationEventPublisher.publishEvent(new MessageEvent(this, msg));
@@ -480,7 +482,7 @@ public class CommandsManager {
String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost()
: HttpUtils.downloadImage(attachment.toURL(), tmpDir).getHost();
String fname = String.format("%d-%d.%s", mid, newrid, attachmentType);
- ImageUtils.saveImageWithPreviews(attachmentFName, fname, tmpDir, imgDir);
+ imagesService.saveImageWithPreviews(attachmentFName, fname);
}
Message reply = messagesService.getReply(mid, newrid);
applicationEventPublisher.publishEvent(new MessageEvent(this, reply));