diff --git a/files/assets/js/comments+submission_listing.js b/files/assets/js/comments+submission_listing.js index 6625dd323..b2ff5e04c 100644 --- a/files/assets/js/comments+submission_listing.js +++ b/files/assets/js/comments+submission_listing.js @@ -14,23 +14,8 @@ function expandDesktopImage(image) { document.getElementById("desktop-expanded-image").src = image.replace("200w_d.webp", "giphy.webp"); document.getElementById("desktop-expanded-image-link").href = image; document.getElementById("desktop-expanded-image-wrap-link").href=image; - history.pushState(null, null, '#modal'); }; -window.addEventListener("hashchange", function (e) { - if(location.hash != "#modal") { - const expandImageModal = document.querySelector('#expandImageModal'); - const modal = bootstrap.Modal.getInstance(expandImageModal); - modal.hide(); - } -}); - -document.getElementById('expandImageModal').addEventListener('hidden.bs.modal', function (e) { - if(location.hash == "#modal") { - history.back(); - } -}); - function popovertrigger() { const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')); const popoverList = popoverTriggerList.map(function(popoverTriggerEl) { diff --git a/files/routes/admin.py b/files/routes/admin.py index 40326a552..52aae2b3b 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -761,6 +761,12 @@ def shadowban(user_id, v): cache.delete_memoized(frontlist) + body = f"@{v.username} has shadowbanned @{user.username}" + + body_html = sanitize(body) + + send_admin(NOTIFICATIONS_ID, body_html) + g.db.commit() return {"message": "User shadowbanned!"} @@ -897,11 +903,13 @@ def ban_user(user_id, v): if days == 0: duration = "permanent" elif days == 1: duration = "1 day" else: duration = f"{days} days" + + note = f'reason: "{reason}", duration: {duration}' ma=ModAction( kind="ban_user", user_id=v.id, target_user_id=user.id, - _note=f'reason: "{reason}", duration: {duration}' + _note=note ) g.db.add(ma) @@ -916,6 +924,14 @@ def ban_user(user_id, v): comment = get_comment(comment) comment.bannedfor = True g.db.add(comment) + + + body = f"@{v.username} has banned @{user.username} ({note})" + + body_html = sanitize(body) + + send_admin(NOTIFICATIONS_ID, body_html) + g.db.commit() if 'redir' in request.values: return redirect(user.url) @@ -929,8 +945,7 @@ def unban_user(user_id, v): user = g.db.query(User).filter_by(id=user_id).one_or_none() - if not user: - abort(400) + if not user: abort(400) user.is_banned = 0 user.unban_utc = 0 diff --git a/files/routes/settings.py b/files/routes/settings.py index 1a3618231..128c935b6 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -751,7 +751,7 @@ def settings_profilecss(v): return render_template("settings_profilecss.html", v=v) @app.post("/settings/block") -@limiter.limit("1/second;30/minute;200/hour;1000/day") +@limiter.limit("1/second;10/day") @auth_required def settings_block_user(v): diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 73b8563ca..ac43f9193 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -1,7 +1,7 @@