From 8207857f4a3ab8a3bdae8aa248637700c6072dd0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 17 Mar 2024 07:55:22 +0300 Subject: Do not resolve nicknames for recommendations --- src/main/java/com/juick/service/MessagesServiceImpl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index 1c504a2d..91a257ef 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -508,8 +508,15 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ new MapSqlParameterSource("mids", mids).addValue("visitorUid", visitorUid), (rs, rowNum) -> { User user = new User(); user.setUid(rs.getInt(2)); - user.setName(rs.getString(3)); - user.setUri(URI.create(rs.getString(4))); + var uri = URI.create(rs.getString(4)); + if (StringUtils.isEmpty(uri.toASCIIString())) { + user.setName(rs.getString(3)); + } else { + user.setUri(uri); + String path = uri.getPath(); + String name = path.substring(path.lastIndexOf('/') + 1); + user.setName(name + "@" + uri.getHost()); + } return new ImmutablePair<>(rs.getInt(1), user); }); } -- cgit v1.2.3