aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-01-13 17:40:17 +0300
committerGravatar Vitaly Takmazov2017-01-13 17:44:35 +0300
commit33af2da48a51f7e6e5c98016e308c61094cf2e0e (patch)
tree71c14b18cd1b2d7efedd864f47b81247419b4aef /juick-www
parentacef82fecd92aec828a05fabc1fb29da7a645d33 (diff)
juick-www: redirect UserThread to right author
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/UserThread.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java
index 5765e02d..6c2e0031 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java
@@ -62,6 +62,7 @@ public class UserThread {
@RequestMapping(value = "/{uname}/{mid}", method = RequestMethod.GET)
protected void doGetThread(HttpServletRequest request, HttpServletResponse response,
+ @PathVariable String uname,
@PathVariable int mid) throws ServletException, IOException {
com.juick.User visitor = webApp.getVisitorUser(request, response);
@@ -76,6 +77,12 @@ public class UserThread {
throw new HttpNotFoundException();
}
+ com.juick.User user = userService.getUserByName(uname);
+ if (user.getUid() == 0 || !msg.getUser().equals(user)) {
+ response.sendRedirect(String.format("/%s/%d", msg.getUser().getName(), mid));
+ return;
+ }
+
boolean listview = false;
String paramView = request.getParameter("view");
if (paramView != null) {