add mentions

This commit is contained in:
2025-12-02 06:13:50 +03:00
parent 414298b4b4
commit 1d5d5a8c64
28 changed files with 366 additions and 64 deletions

View File

@@ -40,10 +40,11 @@ def create_admin():
def create_deleted_user():
username = "DeletedUser"
if Users.count({"username": username}) == 0:
if Users.count({"username": username.lower()}) == 0:
print("Creating DeletedUser")
Users.create({
"username": username,
"username": username.lower(),
"display_name": username,
"password_hash": "",
"permission": PermissionLevel.SYSTEM.value,
})
@@ -61,7 +62,7 @@ def reparse_babycode():
with db.transaction():
for ph in post_histories:
ph.update({
'content': babycode_to_html(ph['original_markup']),
'content': babycode_to_html(ph['original_markup']).result,
'format_version': BABYCODE_VERSION,
})
print('Re-parsing posts done.')
@@ -76,7 +77,7 @@ def reparse_babycode():
with db.transaction():
for user in users_with_sigs:
user.update({
'signature_rendered': babycode_to_html(user['signature_original_markup']),
'signature_rendered': babycode_to_html(user['signature_original_markup']).result,
'signature_format_version': BABYCODE_VERSION,
})
print(f'Re-parsed {len(users_with_sigs)} user sigs.')
@@ -90,7 +91,7 @@ def reparse_babycode():
with db.transaction():
for motd in stale_motds:
motd.update({
'body_rendered': babycode_to_html(motd['body_original_markup'], banned_tags=MOTD_BANNED_TAGS),
'body_rendered': babycode_to_html(motd['body_original_markup'], banned_tags=MOTD_BANNED_TAGS).result,
'format_version': BABYCODE_VERSION,
})
print('Re-parsing MOTDs done.')
@@ -206,7 +207,7 @@ def create_app():
@app.template_filter('babycode')
def babycode_filter(markup):
return babycode_to_html(markup)
return babycode_to_html(markup).result
@app.template_filter('extract_h2')
def extract_h2(content):