aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java11
-rw-r--r--src/main/resources/templates/views/thread.html2
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java4
3 files changed, 12 insertions, 5 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>
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index b97ae8a3..47bb4d22 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1589,14 +1589,14 @@ public class ServerTests {
assertThat(CollectionUtils.isEqualCollection(
messagesService.getMessagesRecommendations(monstreek.getUid(), Collections.singletonList(mid)).stream()
.map(Pair::getRight).map(User::getName).toList(),
- Arrays.asList("ermine", "pogo", "Anonymous")), is(true));
+ Arrays.asList("ermine", "pogo", "test@example.com")), is(true));
privacyQueriesService.blacklistUser(userService.getUserByName("monstreek"),
userService.getUserByName("pogo"));
assertThat(messagesService.getMessage(mid).get().getRecommendations().size(), is(3));
assertThat(CollectionUtils.isEqualCollection(
messagesService.getMessagesRecommendations(monstreek.getUid(), Collections.singletonList(mid)).stream()
.map(Pair::getRight).map(User::getName).toList(),
- Arrays.asList("ermine", "Anonymous")), is(true));
+ Arrays.asList("ermine", "test@example.com")), is(true));
jdbcTemplate.execute("DELETE FROM favorites");
}