mirror of https://github.com/zulip/zulip.git
emoji: Use str.rjust to pad codepoint strings instead of a loop.
This commit is contained in:
parent
0eeb74b3c2
commit
6beb84b553
|
@ -1475,11 +1475,8 @@ def make_realm_emoji(src: str, display_string: str) -> Element:
|
|||
|
||||
def unicode_emoji_to_codepoint(unicode_emoji: str) -> str:
|
||||
codepoint = hex(ord(unicode_emoji))[2:]
|
||||
# Unicode codepoints are minimum of length 4, padded
|
||||
# with zeroes if the length is less than four.
|
||||
while len(codepoint) < 4:
|
||||
codepoint = "0" + codepoint
|
||||
return codepoint
|
||||
# Unicode codepoints are minimum of length 4, padded with zeroes
|
||||
return codepoint.rjust(4, "0")
|
||||
|
||||
|
||||
class EmoticonTranslation(markdown.inlinepatterns.Pattern):
|
||||
|
|
Loading…
Reference in New Issue