mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 12:14:18 +00:00
strip "@." from local reaction names
This commit is contained in:
@@ -340,8 +340,21 @@ namespace MisskeyAPI {
|
||||
return Object.entries(r).map(([key, count]) => {
|
||||
const me = myReaction != null && key === myReaction;
|
||||
|
||||
// Translate the emoji name - "r" mapping includes a leading/trailing ":"
|
||||
const [,name] = key.match(/^:([^@:]+(?:@[^:]+)?):$/) ?? [null,key];
|
||||
// Name is equal to the key for native emoji reactions, and as a fallback.
|
||||
let name = key;
|
||||
|
||||
// Custom emoji have a leading / trailing ":", which we need to remove.
|
||||
const match = key.match(/^:([^@:]+)(@[^:]+)?:$/);
|
||||
if (match) {
|
||||
const [, prefix, host] = match;
|
||||
|
||||
// Local custom emoji end in "@.", which we need to remove.
|
||||
if (host && host !== '@.') {
|
||||
name = prefix + host;
|
||||
} else {
|
||||
name = prefix;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
count,
|
||||
|
||||
Reference in New Issue
Block a user