From 906bf8ef21463f99820764807b656cb617b0aaa2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 28 Jan 2023 18:24:32 +0300 Subject: Cleanup Tag model --- src/main/java/com/juick/www/api/Messages.java | 4 ++-- src/main/java/com/juick/www/controllers/Site.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/juick/www') diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java index 7b54f126..06e3ac87 100644 --- a/src/main/java/com/juick/www/api/Messages.java +++ b/src/main/java/com/juick/www/api/Messages.java @@ -96,7 +96,7 @@ public class Messages { } else if (StringUtils.hasText(tag)) { Tag tagObject = tagService.getTag(tag, false); if (tagObject != null) { - mids = messagesService.getUserTag(user.getUid(), tagObject.TID, 0, before); + mids = messagesService.getUserTag(user.getUid(), tagObject.getId(), 0, before); } else { throw new HttpNotFoundException(); } @@ -121,7 +121,7 @@ public class Messages { } else if (StringUtils.hasText(tag)) { Tag tagObject = tagService.getTag(tag, false); if (tagObject != null) { - mids = messagesService.getTag(tagObject.TID, visitor.getUid(), before, 20); + mids = messagesService.getTag(tagObject.getId(), visitor.getUid(), before, 20); } else { throw new HttpNotFoundException(); } diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java index d0ea3dee..eb483ccc 100644 --- a/src/main/java/com/juick/www/controllers/Site.java +++ b/src/main/java/com/juick/www/controllers/Site.java @@ -267,7 +267,7 @@ public class Site { if (paramShow == null) { if (paramTag != null) { title = "Блог " + user.getName() + ": *" + StringEscapeUtils.escapeHtml4(paramTag.getName()); - mids = messagesService.getUserTag(user.getUid(), paramTag.TID, privacy, before); + mids = messagesService.getUserTag(user.getUid(), paramTag.getId(), privacy, before); } else if (paramSearch != null) { title = "Блог " + user.getName() + ": " + StringEscapeUtils.escapeHtml4(paramSearch); mids = messagesService.getUserSearch(visitor, user.getUid(), paramSearch, @@ -289,7 +289,7 @@ public class Site { String head = ""; head += "\n"; - if (paramTag != null && tagService.getTagNoIndex(paramTag.TID)) { + if (paramTag != null && tagService.getTagNoIndex(paramTag.getId())) { head += ""; } else if (before > 0 || paramShow != null) { head += ""; @@ -402,8 +402,8 @@ public class Site { Tag paramTag = tagService.getTag(paramTagStr, false); if (paramTag == null) { throw new HttpNotFoundException(); - } else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) { - Tag synTag = tagService.getTag(paramTag.SynonymID); + } else if (paramTag.getSynonymId() > 0 && paramTag.getId() != paramTag.getSynonymId()) { + Tag synTag = tagService.getTag(paramTag.getSynonymId()); String url = "/tag/" + URLEncoder.encode(StringEscapeUtils.escapeHtml4(synTag.getName()), StandardCharsets.UTF_8); if (request.getQueryString() != null) { @@ -421,7 +421,7 @@ public class Site { String title = "*" + StringEscapeUtils.escapeHtml4(paramTag.getName()); model.addAttribute("title", title); - List mids = messagesService.getTag(paramTag.TID, visitor.getUid(), before, + List mids = messagesService.getTag(paramTag.getId(), visitor.getUid(), before, (visitor.isAnonymous()) ? 40 : 20); List msgs = messagesService.getMessages(visitor.getUid(), mids); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser()))); @@ -435,7 +435,7 @@ public class Site { } String head = StringUtils.EMPTY; - if (tagService.getTagNoIndex(paramTag.TID)) { + if (tagService.getTagNoIndex(paramTag.getId())) { head = ""; } else if (before > 0 || mids.size() < 5) { head = ""; -- cgit v1.2.3