From e610c996f0107cf3c9dc489e67c1eaebfeb73551 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Sun, 13 Nov 2016 23:49:29 +0700 Subject: using TagUtils class --- server-core/src/main/java/com/juick/server/TagQueries.java | 6 +----- .../src/main/java/com/juick/server/protocol/JuickProtocol.java | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'server-core/src/main/java/com/juick/server') diff --git a/server-core/src/main/java/com/juick/server/TagQueries.java b/server-core/src/main/java/com/juick/server/TagQueries.java index 0e3c0c06..ee9a1e21 100644 --- a/server-core/src/main/java/com/juick/server/TagQueries.java +++ b/server-core/src/main/java/com/juick/server/TagQueries.java @@ -106,7 +106,7 @@ public class TagQueries { return stmt; }, holder); - return holder.getKey().intValue(); + return holder.getKey().intValue(); } public static List getUserTagsAll(JdbcTemplate sql, int uid) { @@ -157,8 +157,4 @@ public class TagQueries { } return Collections.emptyList(); } - public static String toString(List tags) { - return tags.stream().map(t -> " *" + t.getName()) - .collect(Collectors.joining()); - } } diff --git a/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java b/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java index 5faddd3a..e9e129a9 100644 --- a/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java +++ b/server-core/src/main/java/com/juick/server/protocol/JuickProtocol.java @@ -7,6 +7,7 @@ import com.juick.formatters.PlainTextFormatter; import com.juick.json.MessageSerializer; import com.juick.server.*; import com.juick.server.protocol.annotation.UserCommand; +import com.juick.util.TagUtils; import com.juick.xmpp.extensions.JuickMessage; import org.springframework.jdbc.core.JdbcTemplate; @@ -66,7 +67,7 @@ public class JuickProtocol { public ProtocolReply postMessage(User user, String input) { List tags = TagQueries.fromString(sql, input, false); - String body = input.substring(TagQueries.toString(tags).length()); + String body = input.substring(TagUtils.toString(tags).length()); int mid = MessagesQueries.createMessage(sql, user.getUID(), body, null, tags); SubscriptionsQueries.subscribeMessage(sql, mid, user.getUID()); //app.events().publishEvent(new JuickMessageEvent(app.messages().getMessage(mid))); -- cgit v1.2.3