mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-08-22 02:53:38 +00:00
strip "@." from local reaction names
This commit is contained in:
parent
58cdee77d5
commit
876ecb28f0
1 changed files with 15 additions and 2 deletions
|
@ -340,8 +340,21 @@ namespace MisskeyAPI {
|
||||||
return Object.entries(r).map(([key, count]) => {
|
return Object.entries(r).map(([key, count]) => {
|
||||||
const me = myReaction != null && key === myReaction;
|
const me = myReaction != null && key === myReaction;
|
||||||
|
|
||||||
// Translate the emoji name - "r" mapping includes a leading/trailing ":"
|
// Name is equal to the key for native emoji reactions, and as a fallback.
|
||||||
const [,name] = key.match(/^:([^@:]+(?:@[^:]+)?):$/) ?? [null,key];
|
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 {
|
return {
|
||||||
count,
|
count,
|
||||||
|
|
Loading…
Add table
Reference in a new issue