use MOTD_BANNED_TAGS in motd editor view

This commit is contained in:
2025-12-02 06:23:06 +03:00
parent a185208fc1
commit 24fe0aba30
3 changed files with 4 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ from .routes.threads import get_post_url
from .constants import ( from .constants import (
PermissionLevel, permission_level_string, PermissionLevel, permission_level_string,
InfoboxKind, InfoboxHTMLClass, InfoboxKind, InfoboxHTMLClass,
REACTION_EMOJI, REACTION_EMOJI, MOTD_BANNED_TAGS,
) )
from .lib.babycode import babycode_to_html, EMOJI, BABYCODE_VERSION from .lib.babycode import babycode_to_html, EMOJI, BABYCODE_VERSION
from datetime import datetime from datetime import datetime
@@ -176,6 +176,7 @@ def create_app():
"__commit": commit, "__commit": commit,
"__emoji": EMOJI, "__emoji": EMOJI,
"REACTION_EMOJI": REACTION_EMOJI, "REACTION_EMOJI": REACTION_EMOJI,
"MOTD_BANNED_TAGS": MOTD_BANNED_TAGS,
} }
@app.context_processor @app.context_processor

View File

@@ -48,7 +48,7 @@ REACTION_EMOJI = [
] ]
MOTD_BANNED_TAGS = [ MOTD_BANNED_TAGS = [
'img', 'spoiler', 'mention' 'img', 'spoiler', '@mention'
] ]
def permission_level_string(perm): def permission_level_string(perm):

View File

@@ -9,7 +9,7 @@
<label for="title">Title</label> <label for="title">Title</label>
<input name="title" id="title" type="text" required autocomplete="off" placeholder="Required" value="{{ current.title }}"><br> <input name="title" id="title" type="text" required autocomplete="off" placeholder="Required" value="{{ current.title }}"><br>
<label for="body">Body</label> <label for="body">Body</label>
{{ babycode_editor_component('body', ta_placeholder='MOTD body (required)', banned_tags=['img', 'spoiler', '@mention'], prefill=current.body_original_markup) }} {{ babycode_editor_component('body', ta_placeholder='MOTD body (required)', banned_tags=MOTD_BANNED_TAGS, prefill=current.body_original_markup) }}
<input type="submit" value="Save"> <input type="submit" value="Save">
<input class="critical" type="submit" formaction="{{ url_for('mod.motd_delete') }}" value="Delete MOTD" formnovalidate {{"disabled" if not current else ""}}> <input class="critical" type="submit" formaction="{{ url_for('mod.motd_delete') }}" value="Delete MOTD" formnovalidate {{"disabled" if not current else ""}}>
</form> </form>