1
0
Fork 0
mirror of https://github.com/paricafe/misskey.git synced 2025-03-23 11:39:25 -05:00

backend: merge custom emoji reactions

This commit is contained in:
FLY_MC 2025-03-12 05:35:43 +08:00
parent b1df1a4c3b
commit 82d7e472c5
3 changed files with 21 additions and 10 deletions
packages

View file

@ -132,19 +132,30 @@ export class ReactionService {
} else if (_reaction != null) {
const custom = reaction.match(isCustomEmojiRegexp);
if (custom) {
const name = custom[1];
const reacterHost = this.utilityService.toPunyNullable(user.host);
const name = custom[1];
const emoji = reacterHost == null
? (await this.customEmojiService.localEmojisCache.fetch()).get(name)
: await this.emojisRepository.findOneBy({
host: reacterHost,
name,
});
let emoji = null;
let useLocalEmoji = false;
if (reacterHost != null) {
const localEmoji = (await this.customEmojiService.localEmojisCache.fetch()).get(name);
if (localEmoji) {
emoji = localEmoji;
useLocalEmoji = true;
} else {
emoji = await this.emojisRepository.findOneBy({
host: reacterHost,
name,
});
}
} else {
emoji = (await this.customEmojiService.localEmojisCache.fetch()).get(name);
}
if (emoji) {
if (emoji.roleIdsThatCanBeUsedThisEmojiAsReaction.length === 0 || (await this.roleService.getUserRoles(user.id)).some(r => emoji.roleIdsThatCanBeUsedThisEmojiAsReaction.includes(r.id))) {
reaction = reacterHost ? `:${name}@${reacterHost}:` : `:${name}:`;
reaction = useLocalEmoji ? `:${name}:` : (reacterHost ? `:${name}@${reacterHost}:` : `:${name}:`);
// センシティブ
if ((note.reactionAcceptance === 'nonSensitiveOnly' || note.reactionAcceptance === 'nonSensitiveOnlyForLocalLikeOnlyForRemote') && emoji.isSensitive) {

View file

@ -100,4 +100,4 @@ function getReactionName(reaction: string): string {
.more {
padding-top: 4px;
}
</style>
</style>

View file

@ -112,4 +112,4 @@ watch([() => props.note.reactions, () => props.maxNumber], ([newSource, maxNumbe
display: none;
}
}
</style>
</style>