aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/controllers/User.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-04-19 14:51:48 +0300
committerGravatar Vitaly Takmazov2017-05-05 12:06:28 +0300
commit045ca0848c8ee7c771541a5829157531c782cf30 (patch)
tree9a60049dae790fd01ace40d3757c0bfda74cd220 /juick-www/src/main/java/com/juick/www/controllers/User.java
parent9345af5e39695d191b221473ce3a51b03dc09db3 (diff)
juick-www: Home controller uses Pebble, drop ads
wip
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers/User.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/User.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java
index 3e566df9..bc5ebfe3 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/User.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/User.java
@@ -18,6 +18,7 @@
package com.juick.www.controllers;
import com.juick.server.helpers.TagStats;
+import com.juick.server.util.HttpForbiddenException;
import com.juick.service.MessagesService;
import com.juick.service.TagService;
import com.juick.service.UserService;
@@ -28,10 +29,11 @@ import org.apache.commons.lang3.CharEncoding;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
import javax.inject.Inject;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -150,7 +152,7 @@ public class User {
StringEscapeUtils.escapeHtml4(paramTag.getName()) + "</b></a></p>");
}
- templates.printMessages(out, user, mids, visitor, visitor.getUid() == 0 ? 4 : 5, 0);
+ templates.printMessages(out, user, mids, visitor);
if (mids.size() >= 20) {
String nextpage = "?before=" + mids.get(mids.size() - 1);
@@ -202,12 +204,11 @@ public class User {
@GetMapping("/{uname}/friends")
protected void doGetFriends(HttpServletRequest request, HttpServletResponse response,
- @PathVariable String uname) throws ServletException, IOException {
+ @PathVariable String uname) throws IOException {
com.juick.User user = userService.getUserByName(uname);
com.juick.User visitor = UserUtils.getCurrentUser();
if (visitor.isBanned()) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
+ throw new HttpForbiddenException();
}
response.setContentType("text/html; charset=UTF-8");
@@ -240,12 +241,11 @@ public class User {
@GetMapping("/{uname}/readers")
protected void doGetReaders(HttpServletRequest request, HttpServletResponse response,
- @PathVariable String uname) throws ServletException, IOException {
+ @PathVariable String uname) throws IOException {
com.juick.User user = userService.getUserByName(uname);
com.juick.User visitor = UserUtils.getCurrentUser();
if (visitor.isBanned()) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
+ throw new HttpForbiddenException();
}
response.setContentType("text/html; charset=UTF-8");