aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/http/www/NewMessage.java32
-rw-r--r--src/main/webapp/scripts.js5
2 files changed, 15 insertions, 22 deletions
diff --git a/src/main/java/com/juick/http/www/NewMessage.java b/src/main/java/com/juick/http/www/NewMessage.java
index 34733511..e2fe9629 100644
--- a/src/main/java/com/juick/http/www/NewMessage.java
+++ b/src/main/java/com/juick/http/www/NewMessage.java
@@ -141,27 +141,23 @@ public class NewMessage {
body = body.replace("\r", "");
String tagsStr = request.getParameter("tags");
- if (tagsStr == null || tagsStr.isEmpty()) {
- response.sendError(400);
- return;
- }
- String tagsArr[] = tagsStr.split("[ \\,]");
- for (int i = 0; i < tagsArr.length; i++) {
- if (tagsArr[i].startsWith("*")) {
- tagsArr[i] = tagsArr[i].substring(1);
+ ArrayList<com.juick.Tag> tags = new ArrayList<Tag>();
+ String tagsArr[] = new String[1];
+ if (tagsStr != null && !tagsStr.isEmpty()) {
+ tagsArr = tagsStr.split("[ \\,]");
+ for (int i = 0; i < tagsArr.length; i++) {
+ if (tagsArr[i].startsWith("*")) {
+ tagsArr[i] = tagsArr[i].substring(1);
+ }
+ if (tagsArr[i].length() > 64) {
+ tagsArr[i] = tagsArr[i].substring(0, 64);
+ }
}
- if (tagsArr[i].length() > 64) {
- tagsArr[i] = tagsArr[i].substring(0, 64);
+ tags = TagQueries.getTags(sql, tagsArr, true);
+ while (tags.size() > 5) {
+ tags.remove(5);
}
}
- ArrayList<com.juick.Tag> tags = TagQueries.getTags(sql, tagsArr, true);
- if (tags.isEmpty()) {
- response.sendError(400);
- return;
- }
- while (tags.size() > 5) {
- tags.remove(5);
- }
String attachmentFName = null;
try {
diff --git a/src/main/webapp/scripts.js b/src/main/webapp/scripts.js
index 50c8b8d0..8c3b46af 100644
--- a/src/main/webapp/scripts.js
+++ b/src/main/webapp/scripts.js
@@ -140,10 +140,7 @@ function unfoldPostForm() {
}
function onsubmitNewMessage() {
- if($('#newmessage .tags').val().length==0) {
- openDialog('<p class="dialogtxt">Пожалуйста, введите теги сообщения</p>');
- return false;
- } else if($('#newmessage textarea').val().length==0) {
+ if($('#newmessage textarea').val().length==0) {
openDialog('<p class="dialogtxt">Пожалуйста, введите текст сообщения</p>');
return false;
}