Fix crash when sending emails

This commit is contained in:
rubenwardy 2024-01-10 00:16:55 +00:00
parent 610ed8fca5
commit 5a4238dabc

@ -17,7 +17,7 @@
from datetime import datetime as dt
from urllib.parse import urlparse
from flask import request
from flask import request, has_request_context
from flask_babel import format_timedelta, gettext
from flask_login import current_user
from markupsafe import Markup
@ -31,7 +31,10 @@ from .utils.minetest_hypertext import normalize_whitespace as do_normalize_white
@app.context_processor
def inject_misc():
return dict(debug=app.debug, hide_nonfree=request.cookies.get("hide_nonfree") == "1")
hide_nonfree = False
if has_request_context():
hide_nonfree = request.cookies.get("hide_nonfree") == "1"
return dict(debug=app.debug, hide_nonfree=hide_nonfree)
@app.context_processor