mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-20 14:21:00 +00:00
Keep the casing pattern provided by the instance (#495)
This commit is contained in:
parent
d8113ed707
commit
d8fc81a9a6
2 changed files with 19 additions and 2 deletions
|
@ -242,7 +242,7 @@ class Emoji(StatorModel):
|
|||
emoji_hits = FediverseHtmlParser(
|
||||
content, find_emojis=True, emoji_domain=domain
|
||||
).emojis
|
||||
emojis = sorted({emoji.lower() for emoji in emoji_hits})
|
||||
emojis = sorted({emoji for emoji in emoji_hits})
|
||||
return list(
|
||||
cls.objects.filter(local=(domain is None) or domain.local)
|
||||
.usable(domain)
|
||||
|
@ -291,7 +291,7 @@ class Emoji(StatorModel):
|
|||
raise ValueError("No mimetype on emoji JSON")
|
||||
|
||||
# create
|
||||
shortcode = name.lower().strip(":")
|
||||
shortcode = name.strip(":")
|
||||
category = (icon.get("category") or "")[:100]
|
||||
|
||||
if not domain.local:
|
||||
|
|
|
@ -42,3 +42,20 @@ def test_emoji_ingestion(identity):
|
|||
create=True,
|
||||
)
|
||||
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 a new issue