One emoji, one reaction: variation selectors made canonical
A heart reaction arrived as ❤ from some servers and as ❤️ (with the emoji variation selector) from others, and a persona's own reaction kept whatever it was given: the same emoji was two reactions, counted apart. The selector is now dropped and put back only on a symbol that shows as text without it (U+2000 to U+2BFF), so every heart is ❤️ and every 🔥 is 🔥. Found by the town's Hollo pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
ed08f80f05
commit
f70ec59359
2 files changed
+8
No files matched your search
@@ -17,6 +17,9 @@ namespace PrivaPub.Tests.Federation
|
|||||||
[InlineData(":blobcat@k.example:", "blobcat")]
|
[InlineData(":blobcat@k.example:", "blobcat")]
|
||||||
[InlineData("👍🏽", "👍🏽")]
|
[InlineData("👍🏽", "👍🏽")]
|
||||||
[InlineData("❤️", "❤️")]
|
[InlineData("❤️", "❤️")]
|
||||||
|
[InlineData("❤", "❤️")]
|
||||||
|
[InlineData("✌", "✌️")]
|
||||||
|
[InlineData("🔥\uFE0F", "🔥")]
|
||||||
[InlineData("nope", null)]
|
[InlineData("nope", null)]
|
||||||
[InlineData("👍👍", null)]
|
[InlineData("👍👍", null)]
|
||||||
[InlineData(":unknown:", null)]
|
[InlineData(":unknown:", null)]
|
||||||
|
|||||||
@@ -178,6 +178,11 @@ namespace PrivaPub.Domain.Social
|
|||||||
return requireKnownCustom ? default : new Picked(bare, default);
|
return requireKnownCustom ? default : new Picked(bare, default);
|
||||||
return new Picked(bare, emoji.URL);
|
return new Picked(bare, emoji.URL);
|
||||||
}
|
}
|
||||||
|
// one emoji, one name: ❤ and ❤️ (with the emoji variation selector) were two reactions, counted apart. The selector
|
||||||
|
// is dropped, then put back on a symbol that shows as text without it (U+2000 to U+2BFF: ❤, ☺, ✌...)
|
||||||
|
text = text.Replace("\uFE0F", "");
|
||||||
|
if (text.Length == 1 && text[0] is >= '\u2000' and <= '\u2BFF')
|
||||||
|
text += "\uFE0F";
|
||||||
if (text.Any(c => c < 128 || char.IsWhiteSpace(c)) || new StringInfo(text).LengthInTextElements != 1)
|
if (text.Any(c => c < 128 || char.IsWhiteSpace(c)) || new StringInfo(text).LengthInTextElements != 1)
|
||||||
return default;
|
return default;
|
||||||
return new Picked(text, default);
|
return new Picked(text, default);
|
||||||
|
|||||||
Reference in new issue
Block a user