mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-03 23:49:20 +09:00
e3dd3f6b63
* 打てない絵文字を表示しないのではなくグレーアウトするように など * fix: 今度は検索とピン留めに効いてなかった * lint fix * use Map * 斜めに線を引いてわかりやすく * 斜め線は右上からのほうが良かったかも * デザイン調整
13 lines
869 B
TypeScript
13 lines
869 B
TypeScript
import * as Misskey from 'misskey-js';
|
|
import { UnicodeEmojiDef } from './emojilist.js';
|
|
|
|
export function checkReactionPermissions(me: Misskey.entities.MeDetailed, note: Misskey.entities.Note, emoji: Misskey.entities.EmojiSimple | UnicodeEmojiDef): boolean {
|
|
if ('char' in emoji) return true; // UnicodeEmojiDefなら常にリアクション可能
|
|
|
|
emoji = emoji as Misskey.entities.EmojiSimple;
|
|
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)));
|
|
}
|