aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2015-11-04 15:33:16 +0300
committerGravatar Vitaly Takmazov2015-11-04 15:33:16 +0300
commit7b3110f487351fdac35b8433a32ca2f3c00ecc8d (patch)
tree3237b18924b42c5547c0ff76e49104d40f00cfb0
parenta1224e0db03b6116e4f7f2ed7f8ce265c41ca230 (diff)
Revert "try to use uid from url"
This reverts commit a1224e0db03b6116e4f7f2ed7f8ce265c41ca230.
-rw-r--r--src/main/java/com/juick/http/www/Main.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java
index 4c7f7e14..ced7fb98 100644
--- a/src/main/java/com/juick/http/www/Main.java
+++ b/src/main/java/com/juick/http/www/Main.java
@@ -228,21 +228,16 @@ public class Main extends HttpServlet implements Stream.StreamListener {
closeSqlSearch();
} else if (uri.matches("^/\\d+$")) {
String strID = request.getRequestURI().substring(1);
- int uid = 0;
+ int mid = 0;
try {
- uid = Integer.parseInt(strID);
+ mid = Integer.parseInt(strID);
} catch (NumberFormatException e) {
}
- if (uid > 0) {
- com.juick.User author = UserQueries.getUserByUID(sql, uid);
+ if (mid > 0) {
+ com.juick.User author = com.juick.server.MessagesQueries.getMessageAuthor(sql, mid);
if (author != null) {
- if (author.UName != null) {
- Utils.sendPermanentRedirect(response, "/" + author.UName);
- return;
- } else {
- pagesUser.doGetBlog(sql, getSqlSearch(), request, response, author);
- return;
- }
+ Utils.sendPermanentRedirect(response, "/" + author.UName + "/" + mid);
+ return;
}
}
Errors.doGet404(sql, request, response);