aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http/www/User.java
diff options
context:
space:
mode:
authorGravatar Alex Bitney2016-02-06 16:33:29 +0200
committerGravatar Alex Bitney2016-02-06 16:33:29 +0200
commit032f5f7c62ed6932386e700a74dd7e519ad4de5d (patch)
treedd960cb1265c5b63a1eaccd091cb984b28a177d5 /src/main/java/com/juick/http/www/User.java
parentbb93adcf1414001ec3e8439e9440547d52cc8e1d (diff)
domain independence in few places
fixed zero tags exception on user's page
Diffstat (limited to 'src/main/java/com/juick/http/www/User.java')
-rw-r--r--src/main/java/com/juick/http/www/User.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/juick/http/www/User.java b/src/main/java/com/juick/http/www/User.java
index 9ccf43ac..1f2b7dc0 100644
--- a/src/main/java/com/juick/http/www/User.java
+++ b/src/main/java/com/juick/http/www/User.java
@@ -18,6 +18,7 @@
package com.juick.http.www;
import com.juick.Tag;
+import com.juick.server.Endpoints;
import com.juick.server.MessagesQueries;
import com.juick.server.TagQueries;
import com.juick.server.UserQueries;
@@ -271,7 +272,7 @@ public class User {
String hReferer = request.getHeader("Referer");
String ref = Utils.getCookie(request, "ref");
- if (ref == null && (hReferer == null || !(hReferer.startsWith("http://juick.com/") || hReferer.startsWith("https://juick.com/")))) {
+ if (ref == null && (hReferer == null || !(hReferer.startsWith("http://"+ Endpoints.wwwJuickCom+"/") || hReferer.startsWith("https://"+Endpoints.wwwJuickCom+"/")))) {
Cookie c = new Cookie("ref", Integer.toString(uid));
c.setMaxAge(7 * 24 * 60 * 60);
c.setPath("/");
@@ -361,7 +362,7 @@ public class User {
}), user.getUID());
}
- int maxUsageCnt = tags.stream().mapToInt(tag -> tag.UsageCnt).max().getAsInt();
+ int maxUsageCnt = tags.size() > 0 ? tags.stream().mapToInt(tag -> tag.UsageCnt).max().getAsInt() : 1;
return tags.stream().map(tag -> "<a href=\"./?tag=" + URLEncoder.encode(tag.Name) +
"\" title=\"" + tag.UsageCnt + "\" rel=\"nofollow\">" + tag.Name + "</a>")