Keep the casing pattern provided by the instance (#495)
This commit is contained in:
parent
d8113ed707
commit
d8fc81a9a6
|
@ -242,7 +242,7 @@ class Emoji(StatorModel):
|
||||||
emoji_hits = FediverseHtmlParser(
|
emoji_hits = FediverseHtmlParser(
|
||||||
content, find_emojis=True, emoji_domain=domain
|
content, find_emojis=True, emoji_domain=domain
|
||||||
).emojis
|
).emojis
|
||||||
emojis = sorted({emoji.lower() for emoji in emoji_hits})
|
emojis = sorted({emoji for emoji in emoji_hits})
|
||||||
return list(
|
return list(
|
||||||
cls.objects.filter(local=(domain is None) or domain.local)
|
cls.objects.filter(local=(domain is None) or domain.local)
|
||||||
.usable(domain)
|
.usable(domain)
|
||||||
|
@ -291,7 +291,7 @@ class Emoji(StatorModel):
|
||||||
raise ValueError("No mimetype on emoji JSON")
|
raise ValueError("No mimetype on emoji JSON")
|
||||||
|
|
||||||
# create
|
# create
|
||||||
shortcode = name.lower().strip(":")
|
shortcode = name.strip(":")
|
||||||
category = (icon.get("category") or "")[:100]
|
category = (icon.get("category") or "")[:100]
|
||||||
|
|
||||||
if not domain.local:
|
if not domain.local:
|
||||||
|
|
|
@ -42,3 +42,20 @@ def test_emoji_ingestion(identity):
|
||||||
create=True,
|
create=True,
|
||||||
)
|
)
|
||||||
assert emoji2.shortcode == "emoji2"
|
assert emoji2.shortcode == "emoji2"
|
||||||
|
|
||||||
|
cased_emoji = Emoji.by_ap_tag(
|
||||||
|
identity.domain,
|
||||||
|
{
|
||||||
|
"icon": {
|
||||||
|
"type": "Image",
|
||||||
|
"url": "https://example.com/emoji/custom/CasedEmoji.png",
|
||||||
|
"mediaType": "image/png",
|
||||||
|
},
|
||||||
|
"id": "https://example.com/emoji/custom/CasedEmoji.png",
|
||||||
|
"nameMap": {"und": ":CasedEmoji:"},
|
||||||
|
"type": "Emoji",
|
||||||
|
"updated": "1970-01-01T00:00:00Z",
|
||||||
|
},
|
||||||
|
create=True,
|
||||||
|
)
|
||||||
|
assert cased_emoji.shortcode == "CasedEmoji"
|
||||||
|
|
Loading…
Reference in New Issue