forked from rDrama/rDrama
1
0
Fork 0

stop using 204

master
Aevann 2023-10-10 22:34:38 +03:00
parent 4e780473d8
commit 3f9913fc7f
5 changed files with 8 additions and 7 deletions

View File

@ -310,10 +310,11 @@ function sendFormXHR(form, extraActionsOnSuccess) {
t.classList.remove("disabled");
}
if (xhr.status != 204) {
try {
const data = JSON.parse(xhr.response);
showToast(success, getMessageFromJsonData(success, data));
}
catch {}
if (success && extraActionsOnSuccess) extraActionsOnSuccess(xhr);
};

View File

@ -67,4 +67,4 @@ def error_500(e):
def allow_nsfw():
session["nsfw_cookies"] = int(time.time()) + 3600
redir = request.values.get("redir", "/")
return '', 204
return ''

View File

@ -389,7 +389,7 @@ def mobile_app(v):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
def dismiss_mobile_tip():
session["tooltip_dismissed"] = int(time.time())
return "", 204
return ""
@app.get("/transfers/<int:id>")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)

View File

@ -1281,7 +1281,7 @@ def subscribed_posts(v, username):
@auth_required
def fp(v, fp):
if session.get("GLOBAL"):
return '', 204
return ''
v.fp = fp
users = g.db.query(User).filter(User.fp == fp, User.id != v.id).all()
@ -1298,7 +1298,7 @@ def fp(v, fp):
check_for_alts(v, include_current_session=True)
g.db.add(v)
return '', 204
return ''
@app.post("/toggle_pins/<hole>/<sort>")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)

View File

@ -66,7 +66,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
imlazy = 0
if existing and existing.vote_type == new: return "", 204
if existing and existing.vote_type == new: return ""
if existing:
if existing.vote_type == 0 and new != 0:
imlazy = 1
@ -182,7 +182,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
target.author.pay_account('coins', coin_value)
target.author.truescore += coin_delta
return "", 204
return ""
@app.get("/votes/<link>")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)