diff options
4 files changed, 6 insertions, 9 deletions
diff --git a/juick-common/src/main/resources/juick.sql b/juick-common/src/main/resources/juick.sql index 518c89ab..123c0d27 100644 --- a/juick-common/src/main/resources/juick.sql +++ b/juick-common/src/main/resources/juick.sql @@ -593,8 +593,6 @@ DROP TABLE IF EXISTS `subscr_tags`; CREATE TABLE `subscr_tags` ( `tag_id` int(10) unsigned NOT NULL, `suser_id` int(10) unsigned NOT NULL, - `jid` char(64) NOT NULL, - `active` bit(1) NOT NULL DEFAULT b'1', UNIQUE KEY `tag_id` (`tag_id`,`suser_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/juick-server-jdbc/src/main/resources/schema.sql b/juick-server-jdbc/src/main/resources/schema.sql index 68282f88..544b4e51 100644 --- a/juick-server-jdbc/src/main/resources/schema.sql +++ b/juick-server-jdbc/src/main/resources/schema.sql @@ -233,8 +233,6 @@ CREATE TABLE IF NOT EXISTS `subscr_messages` ( CREATE TABLE IF NOT EXISTS `subscr_tags` ( `tag_id` int(10) unsigned NOT NULL, `suser_id` int(10) unsigned NOT NULL, - `jid` char(64) NOT NULL, - `active` bit(1) NOT NULL DEFAULT TRUE, UNIQUE KEY (`tag_id`,`suser_id`) ); diff --git a/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java b/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java index c94e70f3..e2be6aaf 100644 --- a/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java +++ b/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java @@ -451,12 +451,12 @@ public class CommandsManager { } return CommandResult.fromString("Your feed is empty"); } - @UserCommand(pattern = "^(#|\\.)(\\d+)((\\.|\\-|\\/)(\\d+))?\\s([\\s\\S]+)", + @UserCommand(pattern = "^(#|\\.)(\\d+)((\\.|\\-|\\/)(\\d+))?\\s([\\s\\S]+)?", help = "#1234 *tag *tag2 - edit tags\n#1234 text - reply to message") public CommandResult EditOrReply(User user, Jid from, @Nonnull URI attachment, String... args) throws Exception { int mid = NumberUtils.toInt(args[1]); int rid = NumberUtils.toInt(args[4], 0); - String txt = args[5]; + String txt = StringUtils.defaultString(args[5]); List<Tag> messageTags = tagService.fromString(txt, true); if (messageTags.size() > 0) { if (user.getUid() != messagesService.getMessageAuthor(mid).getUid()) { @@ -465,7 +465,8 @@ public class CommandsManager { tagService.updateTags(mid, messageTags); return CommandResult.fromString("Tags are updated"); } else { - String attachmentType = StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null; + String attachmentStr = attachment.toString(); + String attachmentType = StringUtils.isNotEmpty(attachmentStr) ? attachmentStr.substring(attachmentStr.length() - 3) : null; int newrid = messagesService.createReply(mid, rid, user.getUid(), txt, attachmentType); if (StringUtils.isNotEmpty(attachmentType)) { String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost() diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 4dba2523..f9776f2f 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -592,9 +592,9 @@ public class ServerTests { String expectedThirdReply = "Reply posted.\n#" + mid + "/3 " + "https://juick.com/" + mid + "#3"; assertEquals("should be second reply", expectedSecondReply, - commandsManager.processCommand(user, Jid.of("test@localhost"), "#" + mid + " yoyo", emptyUri).get().getText()); + commandsManager.processCommand(user, Jid.of("test@localhost"), "#" + mid + " yoyo", URI.create("http://static.juick.com/settings/facebook.png")).get().getText()); assertEquals("should be third reply", expectedThirdReply, - commandsManager.processCommand(user, Jid.of("test@localhost"), "#" + mid + "/2 yoyo", emptyUri).get().getText()); + commandsManager.processCommand(user, Jid.of("test@localhost"), "#" + mid + "/2 ", URI.create("http://static.juick.com/settings/facebook.png")).get().getText()); Message reply = messagesService.getReplies(mid).stream().filter(m -> m.getRid() == 3).findFirst() .orElse(new Message()); assertEquals("should be reply to second comment", 2, reply.getReplyto()); |