From 8e7a379f0afef3b0fe4e131dfbef350685f7c7f3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 28 Nov 2017 09:55:10 +0300 Subject: Drop outdated moderator buttons * also dropped hardcoded moderator (should be a spring-security role) --- .../com/juick/service/MessagesServiceImpl.java | 4 ++-- .../java/com/juick/www/controllers/Messages.java | 4 ---- juick-www/src/main/static/scripts.js | 27 ---------------------- .../main/webapp/WEB-INF/views/partial/message.html | 5 ---- .../src/main/webapp/WEB-INF/views/thread.html | 5 ---- 5 files changed, 2 insertions(+), 43 deletions(-) diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java index 751b7fc3..721bfb4e 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -859,8 +859,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "n.user_id, users.nick, users.banned, 0 as ago, n.ts, 0 as readonly, 0 as privacy, " + "0 as replies, n.attach, 0 as place_id, 0 as lat, 0 as lon, 0 as likes, 0 as hidden, " + "NULL as tags, NULL as repliesby, n.txt, IFNULL(qw.txt, t.txt) as q " + - "FROM (SELECT * FROM replies WHERE EXISTS (SELECT 1 FROM subscr_messages WHERE suser_id=3694 " + - "AND replies.user_id!=3694 AND replies.message_id=message_id " + + "FROM (SELECT * FROM replies WHERE EXISTS (SELECT 1 FROM subscr_messages WHERE suser_id=:uid " + + "AND replies.user_id!=:uid AND replies.message_id=message_id " + (before != null ? "AND replies.ts < :before " : StringUtils.EMPTY) + ")) as n LEFT JOIN users " + "ON n.user_id = users.id LEFT JOIN replies qw ON n.message_id = qw.message_id " + diff --git a/juick-www/src/main/java/com/juick/www/controllers/Messages.java b/juick-www/src/main/java/com/juick/www/controllers/Messages.java index ce00433b..2af6c21a 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Messages.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Messages.java @@ -205,7 +205,6 @@ public class Messages { String links = sape.getPageLinks(requestURI, sapeCookie).render(); model.addAttribute("links", links); } - model.addAttribute("isModerator", visitor.getUid() == 3694); return "views/index"; } @@ -318,7 +317,6 @@ public class Messages { String links = sape.getPageLinks(requestURI, sapeCookie).render(); model.addAttribute("links", links); } - model.addAttribute("isModerator", visitor.getUid() == 3694); return "views/blog"; } @@ -442,7 +440,6 @@ public class Messages { model.addAttribute("tags", tagService.getPopularTags()); model.addAttribute("noindex", before > 0); model.addAttribute("showAdv", before == 0 && visitor.getUid() == 0); - model.addAttribute("isModerator", visitor.getUid() == 3694); model.addAttribute("isSubscribed", tagService.isSubscribed(visitor, paramTag)); model.addAttribute("isInBL", tagService.isInBL(visitor, paramTag)); if (mids.size() >= 20) { @@ -572,7 +569,6 @@ public class Messages { .collect(Collectors.joining(", ")) + "\" />\n"; } model.addAttribute("headers", headers); - model.addAttribute("isModerator", visitor.getUid() == 3694); model.addAttribute("visitorSubscribed", messagesService.isSubscribed(visitor.getUid(), msg.getMid())); model.addAttribute("visitorInBL", userService.isInBL(msg.getUser().getUid(), visitor.getUid())); model.addAttribute("recomm", messagesService.getMessageRecommendations(msg.getMid())); diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js index 6bea2ea3..afc94973 100644 --- a/juick-www/src/main/static/scripts.js +++ b/juick-www/src/main/static/scripts.js @@ -695,33 +695,6 @@ ready(function () { e.preventDefault(); }); }); - document.querySelectorAll('.l .a-popular-plus').forEach(function (e) { - e.addEventListener('click', function (e) { - setPopular( - e.target, - e.target.closest('article').getAttribute('data-mid'), - 2); - e.preventDefault(); - }); - }); - document.querySelectorAll('.l .a-popular-minus').forEach(function (e) { - e.addEventListener('click', function (e) { - setPopular( - e.target, - e.target.closest('article').getAttribute('data-mid'), - -1); - e.preventDefault(); - }); - }); - document.querySelectorAll('.l .a-popular-delete').forEach(function (e) { - e.addEventListener('click', function (e) { - setPopular( - e.target, - e.target.closest('article').getAttribute('data-mid'), - -2); - e.preventDefault(); - }); - }); document.querySelectorAll('.ir a[data-fname], .msg-media a[data-fname]').forEach(function (el) { el.addEventListener('click', function (e) { let fname = e.target.closest('[data-fname]').getAttribute('data-fname'); diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/message.html b/juick-www/src/main/webapp/WEB-INF/views/partial/message.html index 5950ac7d..2d0e3e97 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/partial/message.html +++ b/juick-www/src/main/webapp/WEB-INF/views/partial/message.html @@ -61,10 +61,5 @@ {% if msg.FriendsOnly %} Открыть доступ {% endif %} - {% if isModerator %} - + - - - x - {% endif %} \ No newline at end of file diff --git a/juick-www/src/main/webapp/WEB-INF/views/thread.html b/juick-www/src/main/webapp/WEB-INF/views/thread.html index 8e30fafa..a488b960 100644 --- a/juick-www/src/main/webapp/WEB-INF/views/thread.html +++ b/juick-www/src/main/webapp/WEB-INF/views/thread.html @@ -70,11 +70,6 @@ {% if msg.FriendsOnly %} Открыть доступ {% endif %} - {% if isModerator %} - + - - - x - {% endif %} {% if msg.VisitorCanComment %}