From 673dbb9b9bab99b458eb94c78d1e54e4c70e4b86 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 19 Oct 2017 15:59:12 +0300 Subject: www: cleanup --- .../main/java/com/juick/www/controllers/Home.java | 25 +++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'juick-www') 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 763d829e..a8a9f1bf 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 @@ -17,13 +17,12 @@ package com.juick.www.controllers; import com.juick.server.util.HttpNotFoundException; +import com.juick.server.util.UserUtils; +import com.juick.server.util.WebUtils; import com.juick.service.MessagesService; import com.juick.service.TagService; import com.juick.service.UserService; -import com.juick.server.util.UserUtils; -import com.juick.server.util.WebUtils; import com.juick.www.Utils; -import com.juick.www.WebApp; import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; @@ -124,32 +123,24 @@ public class Home { } else if (paramShow.equals("top")) { return "redirect:/"; - } else if (paramShow.equals("my") && visitor != null) { + } else if (paramShow.equals("my") && !visitor.isAnonymous()) { title = "Моя лента"; mids = messagesService.getMyFeed(visitor.getUid(), paramBefore, true); - } else if (paramShow.equals("private") && visitor != null) { + } else if (paramShow.equals("private") && !visitor.isAnonymous()) { title = "Приватные"; mids = messagesService.getPrivate(visitor.getUid(), paramBefore); - } else if (paramShow.equals("discuss") && visitor != null) { + } else if (paramShow.equals("discuss") && !visitor.isAnonymous()) { title = "Обсуждения"; mids = messagesService.getDiscussions(visitor.getUid(), paramBefore); - } else if (paramShow.equals("recommended") && visitor != null) { + } else if (paramShow.equals("recommended") && !visitor.isAnonymous()) { title = "Рекомендации"; mids = messagesService.getRecommended(visitor.getUid(), paramBefore); } else if (paramShow.equals("photos")) { title = "Фотографии"; - if (visitor != null) { - mids = messagesService.getPhotos(visitor.getUid(), paramBefore); - } else { - mids = messagesService.getPhotos(0, paramBefore); - } + mids = messagesService.getPhotos(visitor.getUid(), paramBefore); } else if (paramShow.equals("all")) { title = "Все сообщения"; - if (visitor != null) { - mids = messagesService.getAll(visitor.getUid(), paramBefore); - } else { - mids = messagesService.getAll(0, paramBefore); - } + mids = messagesService.getAll(visitor.getUid(), paramBefore); } else { throw new HttpNotFoundException(); } -- cgit v1.2.3