mirror of https://github.com/zulip/zulip.git
emoji: Fix sort order of emoji choices.
The previous code for ensuring the sort order of emoji choices was correct relied on an OrderedDict structure, which isn't guaranteed to be preserved when passed to the frontend via JSON (in fact, it isn't, since we converted the way page_params is passed to use sort_keys=True). Switch it to a list of dictionaries to correct this. Fixes #13220.
This commit is contained in:
parent
4166c901ef
commit
16c9d63056
|
@ -72,18 +72,18 @@
|
|||
|
||||
<div class="input-group">
|
||||
<div class="emojiset_choices grey-box">
|
||||
{{#each page_params.emojiset_choices }}
|
||||
{{#each page_params.emojiset_choices}}
|
||||
<label>
|
||||
<input type="radio" class="emojiset_choice" name="emojiset_group" value="{{@key}}" />
|
||||
<span>{{t this }}</span>
|
||||
<input type="radio" class="emojiset_choice" name="emojiset_group" value="{{this.key}}" />
|
||||
<span>{{this.text}}</span>
|
||||
<span class="right">
|
||||
{{#if (eq @key "text") }}
|
||||
{{#if (eq this.key "text") }}
|
||||
<div class="emoji_alt_code"> :relaxed:</div>
|
||||
{{else}}
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{@key}}-64/1f642.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{@key}}-64/1f44d.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{@key}}-64/1f680.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{@key}}-64/1f389.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{this.key}}-64/1f642.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{this.key}}-64/1f44d.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{this.key}}-64/1f680.png" />
|
||||
<img class="emoji" src="/static/generated/emoji/images-{{this.key}}-64/1f389.png" />
|
||||
{{/if}}
|
||||
</span>
|
||||
</label>
|
||||
|
|
|
@ -41,7 +41,7 @@ from zerver.lib.types import Validator, ExtendedValidator, \
|
|||
|
||||
from bitfield import BitField
|
||||
from bitfield.types import BitHandler
|
||||
from collections import defaultdict, OrderedDict
|
||||
from collections import defaultdict
|
||||
from datetime import timedelta
|
||||
import pylibmc
|
||||
import re
|
||||
|
@ -1037,8 +1037,8 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||
return allowed_bot_types
|
||||
|
||||
@staticmethod
|
||||
def emojiset_choices() -> Dict[str, str]:
|
||||
return OrderedDict((emojiset[0], emojiset[1]) for emojiset in UserProfile.EMOJISET_CHOICES)
|
||||
def emojiset_choices() -> List[Dict[str, str]]:
|
||||
return [dict(key=emojiset[0], text=emojiset[1]) for emojiset in UserProfile.EMOJISET_CHOICES]
|
||||
|
||||
@staticmethod
|
||||
def emails_from_ids(user_ids: Sequence[int]) -> Dict[int, str]:
|
||||
|
|
|
@ -138,7 +138,7 @@ def update_display_settings_backend(
|
|||
raise JsonableError(_("Invalid timezone '%s'") % (timezone,))
|
||||
|
||||
if (emojiset is not None and
|
||||
emojiset not in UserProfile.emojiset_choices()):
|
||||
emojiset not in [emojiset_choice['key'] for emojiset_choice in UserProfile.emojiset_choices()]):
|
||||
raise JsonableError(_("Invalid emojiset '%s'") % (emojiset,))
|
||||
|
||||
if (demote_inactive_streams is not None and
|
||||
|
|
Loading…
Reference in New Issue