diff options
author | Vitaly Takmazov | 2024-03-17 07:55:22 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-03-17 07:55:22 +0300 |
commit | 8207857f4a3ab8a3bdae8aa248637700c6072dd0 (patch) | |
tree | e597af01157029face1464ae5d2e52b04fbd565c /src/main | |
parent | 0e1f88d67d1b9c77a854a887da45a10994cf91f3 (diff) |
Do not resolve nicknames for recommendations
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/juick/service/MessagesServiceImpl.java | 11 | ||||
-rw-r--r-- | src/main/resources/templates/views/thread.html | 2 |
2 files changed, 10 insertions, 3 deletions
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); }); } diff --git a/src/main/resources/templates/views/thread.html b/src/main/resources/templates/views/thread.html index 19d81d75..e3fdee40 100644 --- a/src/main/resources/templates/views/thread.html +++ b/src/main/resources/templates/views/thread.html @@ -110,7 +110,7 @@ {% if rec.uri.toString() is empty %} <a href="/{{ rec.name }}/">@{{ rec.name }}</a>{% if loop.index < (loop.length - 1) %}, {% endif %} {% else %} - <a href="{{ rec.uri }}" data-user-uri="1">@{{ rec.name }}</a>{% if loop.index < (loop.length - 1) %}, {% endif %} + <a href="{{ rec.uri }}">@{{ rec.name }}</a>{% if loop.index < (loop.length - 1) %}, {% endif %} {% endif %} {% endfor %} </div> |