diff --git a/files/assets/CHRISTMAS/js/default.js b/files/assets/CHRISTMAS/js/default.js
index f9cd33ef1..0580b2217 100644
--- a/files/assets/CHRISTMAS/js/default.js
+++ b/files/assets/CHRISTMAS/js/default.js
@@ -104,9 +104,10 @@ function post_toast2(url, button1, button2) {
xhr.withCredentials=true;
xhr.onload = function() {
- if (xhr.status >= 200 && xhr.status < 300) {
+ data=JSON.parse(xhr.response);
+ if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
try {
- document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
+ document.getElementById('toast-post-success-text').innerText = data["message"];
} catch(e) {
document.getElementById('toast-post-success-text').innerText = "Action successful!";
}
diff --git a/files/assets/CHRISTMAS/js/post_toast2.js b/files/assets/CHRISTMAS/js/post_toast2.js
index 1a31bc179..b9ee27339 100644
--- a/files/assets/CHRISTMAS/js/post_toast2.js
+++ b/files/assets/CHRISTMAS/js/post_toast2.js
@@ -15,9 +15,10 @@ function post_toast2(url, button1, button2) {
xhr.withCredentials=true;
xhr.onload = function() {
- if (xhr.status >= 200 && xhr.status < 300) {
+ data=JSON.parse(xhr.response);
+ if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
try {
- document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
+ document.getElementById('toast-post-success-text').innerText = data["message"];
} catch(e) {
document.getElementById('toast-post-success-text').innerText = "Action successful!";
}
@@ -29,8 +30,6 @@ function post_toast2(url, button1, button2) {
window.location.href = JSON.parse(xhr.response)["redirect"]
} else {
try {
- data=JSON.parse(xhr.response);
-
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.show();
document.getElementById('toast-post-error-text').innerText = data["error"];
diff --git a/files/assets/js/post_toast2.js b/files/assets/js/post_toast2.js
index 7f8b37056..a1de58495 100644
--- a/files/assets/js/post_toast2.js
+++ b/files/assets/js/post_toast2.js
@@ -16,7 +16,7 @@ function post_toast2(url, button1, button2) {
xhr.onload = function() {
data = JSON.parse(xhr.response)
- if (xhr.status >= 200 && xhr.status < 300 && !data["error"] ) {
+ if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
try {
document.getElementById('toast-post-success-text').innerText = data["message"];
} catch(e) {}
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 00c647548..700ada0c6 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -967,15 +967,15 @@ def api_distinguish_post(post_id, v):
@validate_formkey
def api_sticky_post(post_id, v):
- pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
- if pins > 2: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
-
post = g.db.query(Submission).filter_by(id=post_id).first()
if post:
if post.stickied:
if post.stickied.startswith("t:"): abort(403)
else: post.stickied = None
- else: post.stickied = v.username
+ else:
+ pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
+ if pins > 2: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
+ post.stickied = v.username
g.db.add(post)
ma=ModAction(
diff --git a/files/templates/CHRISTMAS/changelog.html b/files/templates/CHRISTMAS/changelog.html
index 50541444d..afb8591c9 100644
--- a/files/templates/CHRISTMAS/changelog.html
+++ b/files/templates/CHRISTMAS/changelog.html
@@ -104,6 +104,6 @@
{% endif %}
-
+
{% endblock %}
\ No newline at end of file
diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html
index e23662a86..d4fe66a4e 100644
--- a/files/templates/CHRISTMAS/default.html
+++ b/files/templates/CHRISTMAS/default.html
@@ -346,7 +346,7 @@
{% if v %}
-
+
{% endif %}