fix: megalodon not having checks for emojis

This commit is contained in:
Mar0xy 2023-09-24 00:39:55 +02:00
parent 9dfc4dbf02
commit 4e401408e9
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -136,7 +136,7 @@ namespace MisskeyAPI {
avatar_static: u.avatarUrl, avatar_static: u.avatarUrl,
header: this.plcUrl, header: this.plcUrl,
header_static: this.plcUrl, header_static: this.plcUrl,
emojis: u.emojis.map((e) => this.emoji(e)), emojis: u.emojis && u.emojis.length > 0 ? u.emojis.map((e) => this.emoji(e)) : [],
moved: null, moved: null,
fields: [], fields: [],
bot: false, bot: false,
@ -322,9 +322,9 @@ namespace MisskeyAPI {
plain_content: n.text ? n.text : null, plain_content: n.text ? n.text : null,
created_at: n.createdAt, created_at: n.createdAt,
// Remove reaction emojis with names containing @ from the emojis list. // Remove reaction emojis with names containing @ from the emojis list.
emojis: n.emojis emojis: n.emojis && n.emojis.length > 0 ? n.emojis
.filter((e) => e.name.indexOf("@") === -1) .filter((e) => e.name.indexOf("@") === -1)
.map((e) => this.emoji(e)), .map((e) => this.emoji(e)) : [],
replies_count: n.repliesCount, replies_count: n.repliesCount,
reblogs_count: n.renoteCount, reblogs_count: n.renoteCount,
favourites_count: this.getTotalReactions(n.reactions), favourites_count: this.getTotalReactions(n.reactions),
@ -343,7 +343,7 @@ namespace MisskeyAPI {
language: null, language: null,
pinned: null, pinned: null,
// Use emojis list to provide URLs for emoji reactions. // Use emojis list to provide URLs for emoji reactions.
reactions: this.mapReactions(n.emojis, n.reactions, n.myReaction), reactions: n.emojis && n.emojis.length > 0 ? this.mapReactions(n.emojis, n.reactions, n.myReaction) : [],
bookmarked: false, bookmarked: false,
quote: n.renote && n.text ? this.note(n.renote, host) : null, quote: n.renote && n.text ? this.note(n.renote, host) : null,
}; };