aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-02-23 17:58:54 +0300
committerGravatar Vitaly Takmazov2019-02-23 17:58:54 +0300
commit42af5984ef2decf3763fab51f274fd9940ec23c7 (patch)
tree6d414b223909c923d6ed032c0c34cfa8b211af28 /src/main/java/com/juick/server/CommandsManager.java
parent5731cc328d43a7d4f774c7b974acf610dfd3f9f0 (diff)
Do not post empty messages
Diffstat (limited to 'src/main/java/com/juick/server/CommandsManager.java')
-rw-r--r--src/main/java/com/juick/server/CommandsManager.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/com/juick/server/CommandsManager.java b/src/main/java/com/juick/server/CommandsManager.java
index 004fbf4f..f6f29941 100644
--- a/src/main/java/com/juick/server/CommandsManager.java
+++ b/src/main/java/com/juick/server/CommandsManager.java
@@ -128,6 +128,9 @@ public class CommandsManager {
: HttpUtils.downloadImage(attachment.toURL(), tmpDir).getHost();
attachmentType = attachmentFName.substring(attachmentFName.length() - 3);
}
+ if (StringUtils.isEmpty(body) && !haveAttachment) {
+ return CommandResult.fromString("Empty message");
+ }
int mid = messagesService.createMessage(user.getUid(), body, attachmentType, tags.getRight());
if (haveAttachment) {
String fname = String.format("%d.%s", mid, attachmentType);