Sort custom emoji by name

This commit is contained in:
Thomas Sileo 2019-10-01 23:14:04 +02:00
parent 6090b59c7f
commit 91f879d213
2 changed files with 5 additions and 4 deletions

View file

@ -334,9 +334,10 @@ def admin_new() -> _Response:
default_visibility=default_visibility, default_visibility=default_visibility,
visibility=ap.Visibility, visibility=ap.Visibility,
emojis=config.EMOJIS.split(" "), emojis=config.EMOJIS.split(" "),
custom_emojis={ custom_emojis=sorted(
name: ap.Emoji(**dat) for name, dat in EMOJIS_BY_NAME.items() [ap.Emoji(**dat) for name, dat in EMOJIS_BY_NAME.items()],
}, key=lambda e: e.name,
),
) )
) )

View file

@ -35,7 +35,7 @@
{% for emoji in emojis %} {% for emoji in emojis %}
<span class="ji">{{ emoji | emojify | safe }}</span> <span class="ji">{{ emoji | emojify | safe }}</span>
{% endfor %} {% endfor %}
{% for emoji in custom_emojis.values() %} {% for emoji in custom_emojis %}
<span class="ji"><img src="{{emoji.get_icon_url()}}" alt="{{emoji.name}}" title="{{emoji.name}}" class="custom-emoji"></span> <span class="ji"><img src="{{emoji.get_icon_url()}}" alt="{{emoji.name}}" title="{{emoji.name}}" class="custom-emoji"></span>
{% endfor %} {% endfor %}
</p> </p>