From 26a893b8a308ec77a2420188cdac209e8cd56fac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Mon, 15 Jan 2024 13:27:25 +0200
Subject: [PATCH 1/1] Fixed missing OP/mod flairs
model.py | 86 +++++++++++++++++++++++++++-----------------------------
1 file changed, 42 insertions(+), 44 deletions(-)
diff --git a/model.py b/model.py
index 7e03236..33cd1ac 100644
--- a/model.py
+++ b/model.py
@@ -364,54 +364,52 @@ class User:
and the output is formatted onto multiple lines instead
of being a single line.
"""
if not user_flair.strip():
return ''
out = ''
has_abbrev = False
for flair in User.parse_flair(user_flair):
#print(user_flair, icon, label, scope)
if long_form:
# Show everything in the long form.
if flair.icon():
out += flair.icon() + ' '
if flair.scope:
subspace = db.get_subspace(id=flair.scope)
if subspace:
scope = f" (in {subspace.title()})"
if user_flair.strip():
for flair in User.parse_flair(user_flair):
#print(user_flair, icon, label, scope)
if long_form:
# Show everything in the long form.
if flair.icon():
out += flair.icon() + ' '
if flair.scope:
subspace = db.get_subspace(id=flair.scope)
if subspace:
scope = f" (in {subspace.title()})"
else:
scope = " (in a deleted subspace)"
else:
scope = " (in a deleted subspace)"
else:
scope = ''
if flair.icon():
out += f"{flair.description()}: "
elif not scope and flair.is_admin_assigned:
out += '📛 Assigned flair: '
else:
out += '📛 Personal flair: '
out += f"{flair.label}{scope}{' (set by admin)' if flair.is_admin_assigned else ''}\n"
elif flair.scope == 0 or (context and flair.scope == context.id):
if abbreviate:
if not flair.icon() or flair.type == Flair.SELF_DESCRIPTION:
has_abbrev = True
continue
# Just showing icons and "...".
out += flair.icon()
# elif flair.label:
# has_abbrev = True
else:
# Showing icons and labels.
if len(out):
out += ', '
icon = flair.icon() if flair.type != Flair.SELF_DESCRIPTION else ''
out += icon
if flair.label:
if icon: out += ' '
out += flair.label
scope = ''
if flair.icon():
out += f"{flair.description()}: "
elif not scope and flair.is_admin_assigned:
out += '📛 Assigned flair: '
else:
out += '📛 Personal flair: '
out += f"{flair.label}{scope}{' (set by admin)' if flair.is_admin_assigned else ''}\n"
elif flair.scope == 0 or (context and flair.scope == context.id):
if abbreviate:
if not flair.icon() or flair.type == Flair.SELF_DESCRIPTION:
has_abbrev = True
continue
# Just showing icons and "...".
out += flair.icon()
# elif flair.label:
# has_abbrev = True
else:
# Showing icons and labels.
if len(out):
out += ', '
icon = flair.icon() if flair.type != Flair.SELF_DESCRIPTION else ''
out += icon
if flair.label:
if icon: out += ' '
out += flair.label
if not long_form:
if user_op or user_mod:
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).