aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesService.java2
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java6
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/Help.java1
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/Home.java1
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/NewMessage.java39
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/PM.java2
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java50
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/Settings.java2
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/SignUp.java1
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/User.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/UserThread.java8
-rw-r--r--juick-www/src/main/static/scripts.js167
-rw-r--r--juick-www/src/main/webapp/WEB-INF/layouts/content.html2
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/blog.html2
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/index.html2
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/partial/navigation.html2
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/partial/newmessage.html4
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/pm_inbox.html2
-rw-r--r--juick-www/src/main/webapp/WEB-INF/views/pm_sent.html2
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java27
20 files changed, 129 insertions, 197 deletions
diff --git a/juick-server/src/main/java/com/juick/service/MessagesService.java b/juick-server/src/main/java/com/juick/service/MessagesService.java
index 8948f083..8e9d916b 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesService.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesService.java
@@ -85,6 +85,4 @@ public interface MessagesService {
List<Integer> getLastMessages(int hours);
List<ResponseReply> getLastReplies(int hours);
-
- boolean isReadonly();
}
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index 11ea0cbf..318b5805 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -811,10 +811,4 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
return reply;
}, -hours);
}
-
- @Transactional(readOnly = true)
- @Override
- public boolean isReadonly() {
- return getJdbcTemplate().queryForObject("SELECT @@global.read_only", Integer.class) > 0;
- }
}
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Help.java b/juick-www/src/main/java/com/juick/www/controllers/Help.java
index 847f5d88..602850de 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/Help.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/Help.java
@@ -72,7 +72,6 @@ public class Help {
model.addAttribute("navigation", navigation);
model.addAttribute("content", content);
model.addAttribute("visitor", visitor);
- model.addAttribute("readonly", messagesService.isReadonly());
return "views/help";
}
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java
index 6aa18526..8e875f2f 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/Home.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java
@@ -164,7 +164,6 @@ public class Home {
model.addAttribute("title", title);
model.addAttribute("headers", head);
model.addAttribute("visitor", visitor);
- model.addAttribute("readonly", messagesService.isReadonly());
model.addAttribute("noindex", paramShow == null && paramBefore == 0);
List<com.juick.Message> msgs = messagesService.getMessages(mids);
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
index 4de4f5e9..7875f52b 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
@@ -105,30 +105,27 @@ public class NewMessage {
templates.pageNavigation(out, visitor, null);
out.println("<section id=\"content\" class=\"pagetext\">");
- if (messagesService.isReadonly()) {
- out.println("<p>Временно недоступно</p>");
+
+ out.println("<form action=\"/post2\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">");
+ out.println("<p style=\"text-align: left\"><b>Место: <span id=\"location\"></span></b> <span id=\"locationclear\">&mdash; <a href=\"#\" onclick=\"clearLocation()\">Отменить</a></span></p>");
+ out.println("<p style=\"text-align: left\"><b>Фото:</b> <span id=\"attachmentfile\"><input type=\"file\" name=\"attach\"/> <i>(JPG, PNG, до 10Мб)</i></span></p>");
+
+ String body = request.getParameter("body");
+ if (body == null) {
+ body = StringUtils.EMPTY;
} else {
- out.println("<form action=\"/post2\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">");
- out.println("<p style=\"text-align: left\"><b>Место: <span id=\"location\"></span></b> <span id=\"locationclear\">&mdash; <a href=\"#\" onclick=\"clearLocation()\">Отменить</a></span></p>");
- out.println("<p style=\"text-align: left\"><b>Фото:</b> <span id=\"attachmentfile\"><input type=\"file\" name=\"attach\"/> <i>(JPG, PNG, до 10Мб)</i></span></p>");
-
- String body = request.getParameter("body");
- if (body == null) {
- body = StringUtils.EMPTY;
- } else {
- if (body.length() > 4096) {
- body = body.substring(0, 4096);
- }
- body = StringEscapeUtils.escapeHtml4(body);
+ if (body.length() > 4096) {
+ body = body.substring(0, 4096);
}
- out.println("<p><textarea name=\"body\" class=\"newmessage\" rows=\"7\" cols=\"10\">" + body + "</textarea><br/>");
-
- out.println("<input type=\"hidden\" name=\"place_id\"/>" + "" + "<input type=\"submit\" class=\"subm\" value=\" Отправить \"/></p>");
- out.println("</form>");
- out.println("<div id=\"geomap\"></div>");
- out.println("<p style=\"text-align: left\"><b>Теги:</b></p>");
- printUserTags(out, visitor);
+ body = StringEscapeUtils.escapeHtml4(body);
}
+ out.println("<p><textarea name=\"body\" class=\"newmessage\" rows=\"7\" cols=\"10\">" + body + "</textarea><br/>");
+
+ out.println("<input type=\"hidden\" name=\"place_id\"/>" + "" + "<input type=\"submit\" class=\"subm\" value=\" Отправить \"/></p>");
+ out.println("</form>");
+ out.println("<div id=\"geomap\"></div>");
+ out.println("<p style=\"text-align: left\"><b>Теги:</b></p>");
+ printUserTags(out, visitor);
out.println("</section>");
templates.pageFooter(request, out, visitor, false);
diff --git a/juick-www/src/main/java/com/juick/www/controllers/PM.java b/juick-www/src/main/java/com/juick/www/controllers/PM.java
index 82edb901..90fd14f8 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/PM.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/PM.java
@@ -74,7 +74,6 @@ public class PM {
model.addAttribute("visitor", visitor);
model.addAttribute("msgs", msgs);
model.addAttribute("tags", tagService.getPopularTags());
- model.addAttribute("readonly", messagesService.isReadonly());
return "views/pm_inbox";
}
@@ -97,7 +96,6 @@ public class PM {
model.addAttribute("msgs", msgs);
model.addAttribute("tags", tagService.getPopularTags());
model.addAttribute("uname", uname);
- model.addAttribute("readonly", messagesService.isReadonly());
return "views/pm_sent";
}
diff --git a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java
index 9c6251b0..925d1013 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java
@@ -84,9 +84,9 @@ public class PageTemplates {
out.println("</head>");
out.flush();
if (visitor.getUid() > 0) {
- out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\" data-readonly=\"" + messagesService.isReadonly() + "\">");
+ out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\">");
} else {
- out.println("<body id=\"body\" data-readonly=\"" + messagesService.isReadonly() + "\">");
+ out.println("<body id=\"body\">");
}
}
@@ -112,9 +112,7 @@ public class PageTemplates {
out.print("<li><a href=\"/?show=recommended\">Рекомендации</a></li>");
out.println("</ul></nav>");
out.print(" <nav id=\"actions\"><ul>");
- if (!messagesService.isReadonly()) {
- out.print("<li><a href=\"/#post\">Написать</a></li>");
- }
+ out.print("<li><a href=\"/#post\">Написать</a></li>");
out.print("<li><a href=\"/" + visitor.getName() + "\">@" + visitor.getName() + "</a></li>");
out.print("<li><a href=\"/logout\">Выйти</a></li>");
out.println("</ul></nav>");
@@ -334,29 +332,27 @@ public class PageTemplates {
if (msg.getAttachmentType() != null) {
out.println(" <div class=\"irbr\"></div>");
}
- if (!messagesService.isReadonly()) {
- out.print(" <nav class=\"l\">");
- msg.ReadOnly |= blUIDs.contains(msg.getUser().getUid());
- if (visitor.getUid() == 0) {
- out.print("<a href=\"#\" class=\"a-login\">Рекомендовать</a>");
- } else {
- out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Рекомендовать</a>");
- }
- if (visitor.getUid() == 0 && !msg.ReadOnly) {
- out.print("<a href=\"/" + msg.getMid() + "\" class=\"a-login\">Комментировать</a> ");
- } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) {
- out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> ");
- }
- if (visitor.getUid() > 0 && msg.getPrivacy() < 0 && msg.getUser().getUid() == visitor.getUid()) {
- out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>");
- }
- if (visitor.getUid() > 0 && visitor.getUid() == 3694) {
- out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>");
- out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>");
- out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>");
- }
- out.println("</nav>");
+ out.print(" <nav class=\"l\">");
+ msg.ReadOnly |= blUIDs.contains(msg.getUser().getUid());
+ if (visitor.getUid() == 0) {
+ out.print("<a href=\"#\" class=\"a-login\">Рекомендовать</a>");
+ } else {
+ out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Рекомендовать</a>");
}
+ if (visitor.getUid() == 0 && !msg.ReadOnly) {
+ out.print("<a href=\"/" + msg.getMid() + "\" class=\"a-login\">Комментировать</a> ");
+ } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) {
+ out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> ");
+ }
+ if (visitor.getUid() > 0 && msg.getPrivacy() < 0 && msg.getUser().getUid() == visitor.getUid()) {
+ out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>");
+ }
+ if (visitor.getUid() > 0 && visitor.getUid() == 3694) {
+ out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>");
+ out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>");
+ out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>");
+ }
+ out.println("</nav>");
out.print(" <nav class=\"s\">");
if (msg.getLikes() > 0) {
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Settings.java b/juick-www/src/main/java/com/juick/www/controllers/Settings.java
index ad5d3d27..3c4511c1 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/Settings.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/Settings.java
@@ -112,7 +112,6 @@ public class Settings {
model.addAttribute("telegram_name", crosspostService.getTelegramName(visitor.getUid()));
model.addAttribute("notify_options", subscriptionService.getNotifyOptions(visitor));
model.addAttribute("userinfo", userService.getUserInfo(visitor));
- model.addAttribute("readonly", messagesService.isReadonly());
if (page.equals("auth-email")) {
if (emailService.verifyAddressByCode(visitor.getUid(), request.getParameter("code"))) {
;
@@ -285,7 +284,6 @@ public class Settings {
model.addAttribute("title", "Настройки");
model.addAttribute("visitor", visitor);
model.addAttribute("result", result);
- model.addAttribute("readonly", messagesService.isReadonly());
return "views/settings_result";
}
}
diff --git a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
index f459f3c0..77971165 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
@@ -84,7 +84,6 @@ public class SignUp {
model.addAttribute("account", account);
model.addAttribute("type", type);
model.addAttribute("hash", hash);
- model.addAttribute("readonly", messagesService.isReadonly());
return "views/signup";
}
diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java
index 461a2403..ef79a4b8 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/User.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/User.java
@@ -139,7 +139,6 @@ public class User {
model.addAttribute("visitor", visitor);
model.addAttribute("user", user);
model.addAttribute("noindex", paramShow == null && before == 0);
- model.addAttribute("readonly", messagesService.isReadonly());
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid()));
model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid()));
@@ -197,7 +196,6 @@ public class User {
model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex,nofollow\"/>");
model.addAttribute("visitor", visitor);
model.addAttribute("user", user);
- model.addAttribute("readonly", messagesService.isReadonly());
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid()));
model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid()));
@@ -225,7 +223,6 @@ public class User {
model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex\"/>");
model.addAttribute("visitor", visitor);
model.addAttribute("user", user);
- model.addAttribute("readonly", messagesService.isReadonly());
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid()));
model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid()));
@@ -252,7 +249,6 @@ public class User {
model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex\"/>");
model.addAttribute("visitor", visitor);
model.addAttribute("user", user);
- model.addAttribute("readonly", messagesService.isReadonly());
model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid()));
model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid()));
model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid()));
diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java
index 1d1bb30b..1d854b8f 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java
@@ -175,7 +175,7 @@ public class UserThread {
}
}
- if (msg.VisitorCanComment && !messagesService.isReadonly()) {
+ if (msg.VisitorCanComment) {
out.println(" <form action=\"/comment\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + msg.getMid() + "\"/>");
out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Написать комментарий\"></textarea></div></div>");
out.println(" </form>");
@@ -197,7 +197,7 @@ public class UserThread {
out.println(" <li class=\"toolbar\"><ul>");
out.println(" <li><a href=\"/" + msg.getMid() + "\"><div style=\"background-position: -64px 0\"></div>" + msg.getMid() + "</a></li>");
- if (visitor.getUid() > 0 && !messagesService.isReadonly()) {
+ if (visitor.getUid() > 0) {
if (visitor.getUid() != msg.getUser().getUid()) {
if (messagesService.isSubscribed(visitor.getUid(), msg.getMid())) {
out.println(" <li><a href=\"/post?body=U+%23" + msg.getMid() + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>");
@@ -335,7 +335,7 @@ public class UserThread {
if (msg.getReplyto() > 0) {
out.print(" в ответ на <a href=\"#" + msg.getReplyto() + "\">/" + msg.getReplyto() + "</a>");
}
- if (msg.VisitorCanComment && !messagesService.isReadonly()) {
+ if (msg.VisitorCanComment) {
out.println(" &#183; <a href=\"/post?body=%23" + msg.getMid() + "/" + msg.getRid() + "%20\" class=\"a-thread-comment\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
} else if (visitor.getUid() == 0) {
@@ -381,7 +381,7 @@ public class UserThread {
if (msg.getReplyto() > 0) {
out.print(" в ответ на <a href=\"#" + msg.getReplyto() + "\">/" + msg.getReplyto() + "</a>");
}
- if (msg.VisitorCanComment && !messagesService.isReadonly()) {
+ if (msg.VisitorCanComment) {
out.println(" &#183; <a href=\"#\" class=\"a-thread-comment\">Ответить</a></div>");
out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>");
} else if (visitor.getUid() == 0) {
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 57661caa..3951bfae 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -14,15 +14,10 @@ if (!('remove' in Element.prototype)) { // Firefox <23
NodeList.prototype.forEach = Array.prototype.forEach;
HTMLCollection.prototype.forEach = Array.prototype.forEach;
-function isReadonly() {
- return document.getElementById('body').getAttribute('data-readonly') === 'true';
-}
-
var ws,
pageTitle;
function initWS() {
- if (isReadonly()) { return }
var content = document.getElementById('content');
if (!content) { return }
var pageMID = content.getAttribute('data-mid');
@@ -557,42 +552,40 @@ function ready(fn) {
}
ready(function () {
- if (!isReadonly()) {
- autosize(document.querySelectorAll('textarea'));
-
- var insertButtons = function (e) {
- var textarea = e.target;
- textarea.classList.add('narrow');
- var att = document.createElement('div');
- att.classList.add('attach-photo');
- att.addEventListener('click', function (e) {
- attachCommentPhoto(e.target);
- });
- textarea.parentNode.insertBefore(att, textarea.nextSibling);
- textarea.parentNode.insertAdjacentHTML('afterend', '<input type="submit" value="OK"/>');
- textarea.removeEventListener('click', insertButtons);
- e.preventDefault();
- };
- document.querySelectorAll('textarea.reply').forEach(function (e) {
- e.addEventListener('click', insertButtons);
- e.addEventListener('keypress', function (e) {
- postformListener(e.target, e);
- });
+ autosize(document.querySelectorAll('textarea'));
+
+ var insertButtons = function (e) {
+ var textarea = e.target;
+ textarea.classList.add('narrow');
+ var att = document.createElement('div');
+ att.classList.add('attach-photo');
+ att.addEventListener('click', function (e) {
+ attachCommentPhoto(e.target);
});
+ textarea.parentNode.insertBefore(att, textarea.nextSibling);
+ textarea.parentNode.insertAdjacentHTML('afterend', '<input type="submit" value="OK"/>');
+ textarea.removeEventListener('click', insertButtons);
+ e.preventDefault();
+ };
+ document.querySelectorAll('textarea.reply').forEach(function (e) {
+ e.addEventListener('click', insertButtons);
+ e.addEventListener('keypress', function (e) {
+ postformListener(e.target, e);
+ });
+ });
- var insertPMButtons = function (e) {
- e.target.classList.add('narrowpm');
- e.target.parentNode.insertAdjacentHTML('afterend', '<input type="submit" value="OK"/>');
- e.target.removeEventListener('click', insertPMButtons);
- e.preventDefault();
- };
- document.querySelectorAll('textarea.replypm').forEach(function (e) {
- e.addEventListener('click', insertPMButtons);
- e.addEventListener('keypress', function(e) {
- postformListener(e.target, e);
- });
+ var insertPMButtons = function (e) {
+ e.target.classList.add('narrowpm');
+ e.target.parentNode.insertAdjacentHTML('afterend', '<input type="submit" value="OK"/>');
+ e.target.removeEventListener('click', insertPMButtons);
+ e.preventDefault();
+ };
+ document.querySelectorAll('textarea.replypm').forEach(function (e) {
+ e.addEventListener('click', insertPMButtons);
+ e.addEventListener('keypress', function (e) {
+ postformListener(e.target, e);
});
- }
+ });
var content = document.getElementById('content');
if (content) {
@@ -625,16 +618,14 @@ ready(function () {
e.preventDefault();
});
});
- if (!isReadonly()) {
- document.querySelectorAll('.l .a-comment').forEach(function (e) {
- e.addEventListener('click', function (e) {
- showCommentFooter(
- e.target,
- e.target.closest('article').getAttribute('data-mid'));
- e.preventDefault();
- });
+ document.querySelectorAll('.l .a-comment').forEach(function (e) {
+ e.addEventListener('click', function (e) {
+ showCommentFooter(
+ e.target,
+ e.target.closest('article').getAttribute('data-mid'));
+ e.preventDefault();
});
- }
+ });
document.querySelectorAll('.l .a-privacy').forEach(function (e) {
e.addEventListener('click', function (e) {
setPrivacy(
@@ -643,35 +634,33 @@ ready(function () {
e.preventDefault();
});
});
- if (!isReadonly()) {
- 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-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-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('.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').forEach(function (e) {
e.addEventListener('click', function (e) {
var fname = e.target.closest('[data-fname]').getAttribute('data-fname');
@@ -724,24 +713,22 @@ ready(function () {
e.preventDefault();
});
}
- if (!isReadonly()) {
- var newMessageBlock = document.getElementById('newmessage');
- if (newMessageBlock) {
- var form = newMessageBlock.parentNode;
- form.addEventListener('submit', newMessage);
- newMessageBlock.querySelector('textarea').addEventListener('click', function (e) {
- var parent = e.target.parentNode;
- parent.querySelector('div').style.display = 'block';
- e.target.style.minHeight = '70px';
- e.target.addEventListener('keypress', function (e) {
- postformListener(e.target, e);
- });
- });
- newMessageBlock.querySelector('a').addEventListener('click', function (e) {
- attachMessagePhoto(e.target);
+ var newMessageBlock = document.getElementById('newmessage');
+ if (newMessageBlock) {
+ var form = newMessageBlock.parentNode;
+ form.addEventListener('submit', newMessage);
+ newMessageBlock.querySelector('textarea').addEventListener('click', function (e) {
+ var parent = e.target.parentNode;
+ parent.querySelector('div').style.display = 'block';
+ e.target.style.minHeight = '70px';
+ e.target.addEventListener('keypress', function (e) {
+ postformListener(e.target, e);
});
- }
- }
+ });
+ newMessageBlock.querySelector('a').addEventListener('click', function (e) {
+ attachMessagePhoto(e.target);
+ });
+ }
document.querySelectorAll('article').forEach(function (article) {
if (Array.prototype.some.call(
article.querySelectorAll('.msg-tags a'),
diff --git a/juick-www/src/main/webapp/WEB-INF/layouts/content.html b/juick-www/src/main/webapp/WEB-INF/layouts/content.html
index 00614579..ea9faa0f 100644
--- a/juick-www/src/main/webapp/WEB-INF/layouts/content.html
+++ b/juick-www/src/main/webapp/WEB-INF/layouts/content.html
@@ -12,7 +12,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<link rel="icon" href="//i.juick.com/favicon.png" />
</head>
- <body id="body" data-readonly="{{ readonly }}">
+ <body id="body">
{% include "views/partial/navigation" %}
<section id="content">
{% block content %}
diff --git a/juick-www/src/main/webapp/WEB-INF/views/blog.html b/juick-www/src/main/webapp/WEB-INF/views/blog.html
index a47e952a..88fe6641 100644
--- a/juick-www/src/main/webapp/WEB-INF/views/blog.html
+++ b/juick-www/src/main/webapp/WEB-INF/views/blog.html
@@ -36,7 +36,6 @@
{% if msg.AttachmentType is not empty %}
<div class="irbr"></div>
{% endif %}
- {% if not readonly %}
<nav class="l">
{% if visitor.uid > 0 %}
<a href="/post?body=!+%23{{ msg.mid }}" class="a-like">{{ i18n("messages","message.recommend") }}</a>
@@ -57,7 +56,6 @@
<a href="#" class="a-popular-delete">x</a>
{% endif %}
</nav>
- {% endif %}
<nav class="s">
{% if msg.Likes > 0 %}
<a href="/{{ msg.user.name }}/{{ msg.mid }}" class="likes">
diff --git a/juick-www/src/main/webapp/WEB-INF/views/index.html b/juick-www/src/main/webapp/WEB-INF/views/index.html
index 05ee25c5..082a5464 100644
--- a/juick-www/src/main/webapp/WEB-INF/views/index.html
+++ b/juick-www/src/main/webapp/WEB-INF/views/index.html
@@ -34,7 +34,6 @@
{% if msg.AttachmentType is not empty %}
<div class="irbr"></div>
{% endif %}
- {% if not readonly %}
<nav class="l">
{% if visitor.uid > 0 %}
<a href="/post?body=!+%23{{ msg.mid }}" class="a-like">{{ i18n("messages","message.recommend") }}</a>
@@ -55,7 +54,6 @@
<a href="#" class="a-popular-delete">x</a>
{% endif %}
</nav>
- {% endif %}
<nav class="s">
{% if msg.Likes > 0 %}
<a href="/{{ msg.user.name }}/{{ msg.mid }}" class="likes">
diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/navigation.html b/juick-www/src/main/webapp/WEB-INF/views/partial/navigation.html
index 2abbfcab..60019ab1 100644
--- a/juick-www/src/main/webapp/WEB-INF/views/partial/navigation.html
+++ b/juick-www/src/main/webapp/WEB-INF/views/partial/navigation.html
@@ -25,9 +25,7 @@
</nav>
<nav id="actions">
<ul>
- {% if not readonly %}
<li><a href="/#post">{{ i18n("messages","link.postMessage") }}</a></li>
- {% endif %}
<li><a href="/{{ visitor.getName() }}">@{{ visitor.getName() }}</a></li>
<li><a href="/logout">{{ i18n("messages","link.logout") }}</a></li>
</ul>
diff --git a/juick-www/src/main/webapp/WEB-INF/views/partial/newmessage.html b/juick-www/src/main/webapp/WEB-INF/views/partial/newmessage.html
index 452d1267..1e43b92f 100644
--- a/juick-www/src/main/webapp/WEB-INF/views/partial/newmessage.html
+++ b/juick-www/src/main/webapp/WEB-INF/views/partial/newmessage.html
@@ -1,14 +1,10 @@
<form action="/post" method="post" enctype="multipart/form-data">
<section id="newmessage">
- {% if readonly %}
- <p>Комментирование временно недоступно</p>
- {% else %}
<textarea name="body" placeholder="Новое сообщение..."></textarea>
<div>
<input type="text" class="img" name="img" placeholder="Ссылка на изображение (JPG/PNG, до 10Мб)"/> или <a href="#">загрузить</a><br/>
<input type="text" class="tags" name="tags" placeholder="Теги (через пробел)"/><br/>
<input type="submit" class="subm" value="Отправить"/>
</div>
- {% endif %}
</section>
</form> \ No newline at end of file
diff --git a/juick-www/src/main/webapp/WEB-INF/views/pm_inbox.html b/juick-www/src/main/webapp/WEB-INF/views/pm_inbox.html
index ef327734..a8a8a1e9 100644
--- a/juick-www/src/main/webapp/WEB-INF/views/pm_inbox.html
+++ b/juick-www/src/main/webapp/WEB-INF/views/pm_inbox.html
@@ -16,7 +16,6 @@
</div>
<div class="msg-txt">{{ msg | formatMessage }}</div>
- {% if not readonly %}
<form action="/pm/send" method="POST" enctype="multipart/form-data">
<input type="hidden" name="uname" value="{{ msg.user.name }}"/>
<div class="msg-comment">
@@ -25,7 +24,6 @@
</div>
</div>
</form>
- {% endif %}
</div>
</li>
{% endfor %}
diff --git a/juick-www/src/main/webapp/WEB-INF/views/pm_sent.html b/juick-www/src/main/webapp/WEB-INF/views/pm_sent.html
index cd1a4a94..48aaa7e1 100644
--- a/juick-www/src/main/webapp/WEB-INF/views/pm_sent.html
+++ b/juick-www/src/main/webapp/WEB-INF/views/pm_sent.html
@@ -1,6 +1,5 @@
{% extends "layouts/content" %}
{% block content %}
-{% if not readonly %}
<form action="/pm/send" method="POST" enctype="multipart/form-data">
<div class="newpm">
<div class="newpm-to">To: <input type="text" name="uname" placeholder="username" value="{{ uname }}"/></div>
@@ -8,7 +7,6 @@
<div class="newpm-send"><input type="submit" value="OK"/></div>
</div>
</form>
-{% endif %}
{% if not msgs.isEmpty() %}
<ul id="private-messages">
{% for msg in msgs %}
diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java
index c6e9b1c7..5b6dd353 100644
--- a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java
+++ b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java
@@ -39,9 +39,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
public JuickBot(XMPPServer xmpp) {
this.xmpp = xmpp;
xmpp.addStanzaListener(this);
- if (!xmpp.messagesService.isReadonly()) {
- broadcastPresence(null);
- }
+ broadcastPresence(null);
pt = new PrettyTime(new Locale("ru"));
}
@@ -185,14 +183,10 @@ public class JuickBot implements StanzaListener, AutoCloseable {
reply.setFrom(msg.getTo());
reply.setTo(msg.getFrom());
reply.setType(Message.Type.CHAT);
- if (xmpp.messagesService.isReadonly()) {
- reply.setBody("Регистрация временно недоступна\n\nRegistration temporarily unavailable");
+ if (username.equals(xmpp.getJid().getLocal())) {
+ reply.setBody("Для того, чтобы начать пользоваться сервисом, пожалуйста пройдите быструю регистрацию: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nTo start using Juick, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
} else {
- if (username.equals(xmpp.getJid().getLocal())) {
- reply.setBody("Для того, чтобы начать пользоваться сервисом, пожалуйста пройдите быструю регистрацию: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nTo start using Juick, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
- } else {
- reply.setBody("Внимание, системное сообщение!\nВаш JabberID не обнаружен в списке доверенных. Для того, чтобы отправить сообщение пользователю " + username + "@juick.com, пожалуйста зарегистрируйте свой JabberID в системе: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nWarning, system message!\nYour JabberID is not found in our server's white list. To send a message to " + username + "@juick.com, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
- }
+ reply.setBody("Внимание, системное сообщение!\nВаш JabberID не обнаружен в списке доверенных. Для того, чтобы отправить сообщение пользователю " + username + "@juick.com, пожалуйста зарегистрируйте свой JabberID в системе: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nWarning, system message!\nYour JabberID is not found in our server's white list. To send a message to " + username + "@juick.com, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
}
xmpp.sendOut(ClientMessage.from(reply));
return true;
@@ -216,7 +210,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
}
boolean success = false;
- if (!xmpp.userService.isInBLAny(uid_to, user_from.getUid()) && !xmpp.messagesService.isReadonly()) {
+ if (!xmpp.userService.isInBLAny(uid_to, user_from.getUid())) {
success = xmpp.pmQueriesService.createPM(user_from.getUid(), uid_to, msg.getBody());
}
@@ -300,8 +294,6 @@ public class JuickBot implements StanzaListener, AutoCloseable {
return commandLast(msg.getFrom());
} else if (command.equalsIgnoreCase("@")) {
return commandUsers(msg.getFrom());
- } else if (xmpp.messagesService.isReadonly()) {
- return commandMaintenance(msg.getFrom());
}
return false;
@@ -452,11 +444,6 @@ public class JuickBot implements StanzaListener, AutoCloseable {
return true;
}
- private boolean commandMaintenance(Jid jidFrom) {
- sendReply(jidFrom, "Комментирование временно недоступно");
- return true;
- }
-
void sendReply(Jid jidTo, String txt) {
Message reply = new Message();
reply.setFrom(xmpp.getJid());
@@ -505,8 +492,6 @@ public class JuickBot implements StanzaListener, AutoCloseable {
@Override
public void close() throws Exception {
- if (!xmpp.messagesService.isReadonly()) {
- broadcastPresence(Presence.Type.UNAVAILABLE);
- }
+ broadcastPresence(Presence.Type.UNAVAILABLE);
}
}