From 3ec1ccf563008338197dc3e306551ef1f8e8362e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 4 May 2017 14:22:12 +0300 Subject: juick-www: fix bl --- .../src/main/java/com/juick/www/controllers/Home.java | 10 +++++++++- juick-www/src/main/webapp/WEB-INF/views/index.html | 16 +++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'juick-www/src/main') diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java index cde9e635..22cf4b90 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Home.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java @@ -43,6 +43,7 @@ import javax.inject.Inject; import java.io.IOException; import java.net.URLEncoder; import java.util.List; +import java.util.stream.Collectors; /** * @@ -165,7 +166,14 @@ public class Home { model.addAttribute("visitor", visitor); model.addAttribute("readonly", messagesService.isReadonly()); model.addAttribute("noindex", paramShow == null && paramBefore == 0); - model.addAttribute("msgs", messagesService.getMessages(mids)); + List msgs = messagesService.getMessages(mids); + + if (visitor.getUid() != 0) { + List blUIDs = userService.checkBL(visitor.getUid(), + msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList())); + msgs.forEach(m -> m.ReadOnly |= blUIDs.contains(m.getUser().getUid())); + } + model.addAttribute("msgs", msgs); model.addAttribute("tags", tagService.getPopularTags()); model.addAttribute("headers", head); model.addAttribute("showAdv", diff --git a/juick-www/src/main/webapp/WEB-INF/views/index.html b/juick-www/src/main/webapp/WEB-INF/views/index.html index 04ae32bd..a17a15e7 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/index.html +++ b/juick-www/src/main/webapp/WEB-INF/views/index.html @@ -26,21 +26,27 @@ - {%if msg.AttachmentType is not empty %} + {% if msg.AttachmentType is not empty %}

{% endif %}

{{ msg | formatMessage }}

- {%if msg.AttachmentType is not empty %} + {% if msg.AttachmentType is not empty %}
{% endif %} {% if not readonly %}