From 91f879d2132ebe6a77a0f99788f33e5a0708cd6d Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 1 Oct 2019 23:14:04 +0200 Subject: [PATCH] Sort custom emoji by name --- blueprints/admin.py | 7 ++++--- templates/new.html | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/blueprints/admin.py b/blueprints/admin.py index e8a08e8..c3e666e 100644 --- a/blueprints/admin.py +++ b/blueprints/admin.py @@ -334,9 +334,10 @@ def admin_new() -> _Response: default_visibility=default_visibility, visibility=ap.Visibility, emojis=config.EMOJIS.split(" "), - custom_emojis={ - name: ap.Emoji(**dat) for name, dat in EMOJIS_BY_NAME.items() - }, + custom_emojis=sorted( + [ap.Emoji(**dat) for name, dat in EMOJIS_BY_NAME.items()], + key=lambda e: e.name, + ), ) ) diff --git a/templates/new.html b/templates/new.html index fa74059..34c61e1 100644 --- a/templates/new.html +++ b/templates/new.html @@ -35,7 +35,7 @@ {% for emoji in emojis %} {{ emoji | emojify | safe }} {% endfor %} -{% for emoji in custom_emojis.values() %} +{% for emoji in custom_emojis %} {{emoji.name}} {% endfor %}