Skip to content

Commit

Permalink
Update UserDto.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Nonononoki committed Dec 27, 2024
1 parent 31d6090 commit 225db68
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/nonononoki/alovoa/model/UserDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,13 @@ public static UserDto userToUserDto(DtoBuilder builder)
.anyMatch(o -> Objects.equals(o.getUserTo().getId(), user.getId()));
}
if (user.getLikes() != null) {
dto.likesCurrentUser = user.getLikes().stream()
.filter(o -> o.getUserTo() != null)
.anyMatch(o -> Objects.equals(o.getUserTo().getId(), currentUser.getId()));
try {
dto.likesCurrentUser = user.getLikes().stream()
.filter(o -> o.getUserTo() != null)
.anyMatch(o -> Objects.equals(o.getUserTo().getId(), currentUser.getId()));
} catch (Exception ignored) {
dto.likesCurrentUser = false;
}
}
if (currentUser.getLikes() != null) {
dto.likedByCurrentUser = currentUser.getLikes().stream()
Expand Down

0 comments on commit 225db68

Please sign in to comment.