mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2025-04-13 09:44:40 +00:00
fix reaction emoji mapping in mastodon API
This commit is contained in:
parent
ebc3abea54
commit
dcdc249e77
1 changed files with 9 additions and 5 deletions
|
@ -336,14 +336,18 @@ namespace MisskeyAPI {
|
|||
};
|
||||
|
||||
export const mapReactions = (r: { [key: string]: number }, e: Record<string, string | undefined>, myReaction?: string): Array<MegalodonEntity.Reaction> => {
|
||||
return Object.keys(r).map(key => {
|
||||
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];
|
||||
|
||||
return {
|
||||
count: r[key],
|
||||
count,
|
||||
me,
|
||||
name: key,
|
||||
url: e[key],
|
||||
static_url: e[key],
|
||||
name,
|
||||
url: e[name],
|
||||
static_url: e[name],
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue