aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/Home.java10
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/index.html16
2 files changed, 20 insertions, 6 deletions
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<com.juick.Message> msgs = messagesService.getMessages(mids);
+
+ if (visitor.getUid() != 0) {
+ List<Integer> 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 @@
</div>
</header>
- {%if msg.AttachmentType is not empty %}
+ {% if msg.AttachmentType is not empty %}
<p class="ir"><a href="//i.juick.com/photos-512/{{ msg.getMid() }}.{{ msg.AttachmentType }}"
onclick="return showPhotoDialog('{{ msg.getMid() }}.{{ msg.AttachmentType }}')">
<img src="//i.juick.com/photos-512/{{ msg.getMid() }}.{{ msg.AttachmentType }}" alt=""/></a>
</p>
{% endif %}
<p>{{ msg | formatMessage }}</p>
- {%if msg.AttachmentType is not empty %}
+ {% if msg.AttachmentType is not empty %}
<div class="irbr"></div>
{% endif %}
{% if not readonly %}
<nav class="l">
- <a href="#" class="a-like">Мне нравится</a>
- {% if msg.VisitorCanComment %}
- <a href="#" class="a-comment">Комментировать</a>
+ {% if visitor.uid > 0 %}
+ <a href="/post?body=!+%23{{ msg.getMid() }}" class="a-like">Рекомендовать</a>
+ {% else %}
+ <a href="/login" class="a-login">Рекомендовать</a>
+ {% endif %}
+ {% if visitor.uid > 0 and (not msg.ReadOnly or visitor.uid == msg.user.uid) %}
+ <a href="/{{ msg.getMid() }}" class="a-comment">Комментировать</a>
+ {% elseif visitor.uid == 0 and not msg.ReadOnly %}
+ <a href="/login" class="a-login">Комментировать</a>
{% endif %}
{% if msg.FriendsOnly %}
<a href="#" class="a-privacy">Открыть доступ</a>