mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Update blocked site message
This commit is contained in:
parent
cc1eec93d5
commit
605015f812
@ -75,7 +75,7 @@ def review(package):
|
||||
# Validate and submit
|
||||
elif can_review and form.validate_on_submit():
|
||||
if has_blocked_domains(form.comment.data, current_user.username, f"review of {package.getId()}"):
|
||||
flash(gettext("Linking to malicious sites is not allowed."), "danger")
|
||||
flash(gettext("Linking to blocked sites is not allowed"), "danger")
|
||||
else:
|
||||
was_new = False
|
||||
if not review:
|
||||
|
@ -200,7 +200,7 @@ def edit_reply(id):
|
||||
if form.validate_on_submit():
|
||||
comment = form.comment.data
|
||||
if has_blocked_domains(comment, current_user.username, f"edit to reply {reply.get_url(True)}"):
|
||||
flash(gettext("Linking to malicious sites is not allowed."), "danger")
|
||||
flash(gettext("Linking to blocked sites is not allowed"), "danger")
|
||||
else:
|
||||
msg = "Edited reply by {}".format(reply.author.display_name)
|
||||
severity = AuditSeverity.NORMAL if current_user == reply.author else AuditSeverity.MODERATION
|
||||
@ -233,7 +233,7 @@ def view(id):
|
||||
return redirect(thread.getViewURL())
|
||||
|
||||
if has_blocked_domains(comment, current_user.username, f"reply to {thread.getViewURL(True)}"):
|
||||
flash(gettext("Linking to malicious sites is not allowed."), "danger")
|
||||
flash(gettext("Linking to blocked sites is not allowed"), "danger")
|
||||
return render_template("threads/view.html", thread=thread, form=form)
|
||||
|
||||
reply = ThreadReply()
|
||||
@ -325,7 +325,7 @@ def new():
|
||||
# Validate and submit
|
||||
elif form.validate_on_submit():
|
||||
if has_blocked_domains(form.comment.data, current_user.username, f"new thread"):
|
||||
flash(gettext("Linking to malicious sites is not allowed."), "danger")
|
||||
flash(gettext("Linking to blocked sites is not allowed"), "danger")
|
||||
else:
|
||||
thread = Thread()
|
||||
thread.author = current_user
|
||||
|
@ -82,7 +82,7 @@ def handle_profile_edit(form: UserProfileForm, user: User, username: str):
|
||||
if user.checkPerm(current_user, Permission.CHANGE_PROFILE_URLS):
|
||||
if has_blocked_domains(form.website_url.data, current_user.username, f"{user.username}'s website_url") or \
|
||||
has_blocked_domains(form.donate_url.data, current_user.username, f"{user.username}'s donate_url"):
|
||||
flash(gettext("Linking to malicious sites is not allowed."), "danger")
|
||||
flash(gettext("Linking to blocked sites is not allowed"), "danger")
|
||||
return
|
||||
|
||||
user.website_url = form.website_url.data
|
||||
|
@ -121,7 +121,7 @@ def do_edit_package(user: User, package: Package, was_new: bool, was_web: bool,
|
||||
for field in ["short_desc", "desc", "website", "issueTracker", "repo", "video_url"]:
|
||||
if field in data and has_blocked_domains(data[field], user.username,
|
||||
f"{field} of {package.getId()}"):
|
||||
raise LogicError(403, lazy_gettext("Linking to malicious sites is not allowed."))
|
||||
raise LogicError(403, lazy_gettext("Linking to blocked sites is not allowed"))
|
||||
|
||||
if "type" in data:
|
||||
data["type"] = PackageType.coerce(data["type"])
|
||||
|
@ -63,7 +63,7 @@ def has_blocked_domains(text: str, username: str, location: str) -> bool:
|
||||
if domain in text:
|
||||
from app.tasks.webhooktasks import post_discord_webhook
|
||||
post_discord_webhook.delay(username,
|
||||
f"Attempted to post link to blocked domain {domain} in {location}",
|
||||
f"Attempted to post blocked domain {domain} in {location}",
|
||||
True)
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user