aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-04-09 16:33:00 +0300
committerGravatar Vitaly Takmazov2020-04-09 16:33:00 +0300
commitaa0070140058603de7d60c8e039bb4a535399f3a (patch)
tree34af174e3b929e30a62b63c33df41e39d09b8bf7 /src
parentd3434414565f523d397e00fafdebfb46eb103c67 (diff)
/user/tag? => /user/search?
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/www/controllers/Site.java26
-rw-r--r--src/main/resources/templates/views/blog.html2
2 files changed, 5 insertions, 23 deletions
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java
index a8cbc9bd..537b0a6e 100644
--- a/src/main/java/com/juick/www/controllers/Site.java
+++ b/src/main/java/com/juick/www/controllers/Site.java
@@ -185,7 +185,6 @@ public class Site {
@RequestParam(required = false, name = "page", defaultValue = "0") Integer page,
@PathVariable String uname,
@RequestParam(required = false, defaultValue = "0") Integer before,
- @CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie,
ModelMap model) {
User user = userService.getUserByName(uname);
if (user.isBanned() || user.isAnonymous()) {
@@ -195,17 +194,8 @@ public class Site {
List<Integer> mids;
- Tag paramTag = null;
if (paramTagStr != null) {
- if (paramTagStr.length() < 64) {
- paramTag = tagService.getTag(paramTagStr, false);
- }
- if (paramTag == null) {
- throw new HttpNotFoundException();
- } else if (!paramTag.getName().equals(paramTagStr)) {
- String url = user.getName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), StandardCharsets.UTF_8);
- return "redirect:/" + url;
- }
+ paramSearch = paramTagStr;
}
if (paramSearch != null && paramSearch.length() > 64) {
paramSearch = null;
@@ -222,10 +212,7 @@ public class Site {
String title;
if (paramShow == null) {
- if (paramTag != null) {
- title = "Блог " + user.getName() + ": *" + StringEscapeUtils.escapeHtml4(paramTag.getName());
- mids = messagesService.getUserTag(user.getUid(), paramTag.TID, privacy, before);
- } else if (paramSearch != null) {
+ if (paramSearch != null) {
title = "Блог " + user.getName() + ": " + StringEscapeUtils.escapeHtml4(paramSearch);
mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(paramSearch), privacy, page);
} else {
@@ -245,9 +232,7 @@ public class Site {
String head = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" +
user.getName() + "\" href=\"//rss.juick.com/" + user.getName() + "/blog\"/>";
head += "<meta name=\"Description\" content=\"" + title + "\" />\n";
- if (paramTag != null && tagService.getTagNoIndex(paramTag.TID)) {
- head += "<meta name=\"robots\" content=\"noindex,nofollow\"/>";
- } else if (before > 0 || paramShow != null) {
+ if (before > 0 || paramShow != null) {
head += "<meta name=\"robots\" content=\"noindex\"/>";
}
model.addAttribute("pageUrl", "http://juick.com/" + user.getName());
@@ -256,7 +241,7 @@ public class Site {
model.addAttribute("visitor", visitor);
model.addAttribute("noindex", paramShow == null && before == 0);
fillUserModel(model, user, visitor);
- model.addAttribute("paramTag", paramTag);
+ model.addAttribute("paramTag", paramSearch);
List<Message> msgs = messagesService.getMessages(visitor, mids);
msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser())));
if (!visitor.isAnonymous()) {
@@ -276,9 +261,6 @@ public class Site {
if (paramSearch != null) {
nextpage += "&amp;search=" + URLEncoder.encode(paramSearch, StandardCharsets.UTF_8);
}
- if (paramTag != null) {
- nextpage += "&amp;tag=" + URLEncoder.encode(paramTag.getName(), StandardCharsets.UTF_8);
- }
model.addAttribute("nextpage", nextpage);
}
return "views/blog";
diff --git a/src/main/resources/templates/views/blog.html b/src/main/resources/templates/views/blog.html
index 91decad6..79a1efe8 100644
--- a/src/main/resources/templates/views/blog.html
+++ b/src/main/resources/templates/views/blog.html
@@ -5,7 +5,7 @@
<!--noindex-->
{% endif %}
{% if paramTag | default('') is not empty %}
-<p class="page"><a href="/tag/{{ paramTag.name | urlencode }}">← {{ i18n("messages","blog.allPostsWithTag") }} <b>{{ paramTag.name | escape }}</b></a></p>
+<p class="page"><a href="/tag/{{ paramTag | urlencode }}">← {{ i18n("messages","blog.allPostsWithTag") }} <b>{{ paramTag | escape }}</b></a></p>
{% endif %}
<div>
{% for msg in msgs %}