mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-03 23:49:20 +09:00
9 lines
660 B
TypeScript
9 lines
660 B
TypeScript
|
import * as Misskey from 'misskey-js';
|
||
|
|
||
|
export function checkReactionPermissions(me: Misskey.entities.MeDetailed, note: Misskey.entities.Note, emoji: Misskey.entities.EmojiSimple): boolean {
|
||
|
const roleIdsThatCanBeUsedThisEmojiAsReaction = emoji.roleIdsThatCanBeUsedThisEmojiAsReaction ?? [];
|
||
|
return !(emoji.localOnly && note.user.host !== me.host)
|
||
|
&& !(emoji.isSensitive && (note.reactionAcceptance === 'nonSensitiveOnly' || note.reactionAcceptance === 'nonSensitiveOnlyForLocalLikeOnlyForRemote'))
|
||
|
&& (roleIdsThatCanBeUsedThisEmojiAsReaction.length === 0 || me.roles.some(role => roleIdsThatCanBeUsedThisEmojiAsReaction.includes(role.id)));
|
||
|
}
|