From 946f5f0f309d46e9ffaca98e4c70ab531614567d Mon Sep 17 00:00:00 2001 From: Oleh Astappiev Date: Mon, 19 Feb 2024 21:56:11 +0100 Subject: [PATCH] fix(server): displaying list of chats --- .../l3s/interweb/core/util/StringUtils.java | 22 ------------------- .../server/features/chat/ChatResource.java | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/interweb-core/src/main/java/de/l3s/interweb/core/util/StringUtils.java b/interweb-core/src/main/java/de/l3s/interweb/core/util/StringUtils.java index 119d7fa5..5dd7a367 100644 --- a/interweb-core/src/main/java/de/l3s/interweb/core/util/StringUtils.java +++ b/interweb-core/src/main/java/de/l3s/interweb/core/util/StringUtils.java @@ -12,13 +12,6 @@ public final class StringUtils { private StringUtils() { } - /** - * Splits CSV string to list removing duplicates. - */ - public static List toList(String s) { - return Arrays.asList(s.split("[,\\s]")); - } - public static Set toIdSet(String s) { Set set = new HashSet<>(); String[] tokens = s.split("[,\\s]"); @@ -40,21 +33,6 @@ public static Set toIdSet(String[] tokens) { return set; } - public static > Set toEnumSet(String s, Class typeClass) { - Set set = new HashSet<>(); - String[] tokens = s.split("[,\\s]"); - for (String token : tokens) { - if (!token.isBlank()) { - try { - set.add(Enum.valueOf(typeClass, token.trim().toLowerCase())); - } catch (IllegalArgumentException ignored) { - // ignore invalid values - } - } - } - return set; - } - /** * If the string is longer than maxLength it is split at the nearest blank space. */ diff --git a/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatResource.java b/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatResource.java index b6fb1afc..bc3bc480 100644 --- a/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatResource.java +++ b/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatResource.java @@ -47,7 +47,7 @@ public Uni> chats( Token token = securityIdentity.getCredential(Token.class); return Chat.listByUser(token, user, order, page, perPage) - .flatMap(chats -> Multi.createFrom().iterable(chats).filter(chat -> chat.title == null).call(ChatResource::createChatTitle).collect().asList()); + .call(chats -> Multi.createFrom().iterable(chats).filter(chat -> chat.title == null).map(ChatResource::createChatTitle).collect().asList()); } private static Uni> createChatTitle(Chat chat) {