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:
parent
b1df1a4c3b
commit
82d7e472c5
3 changed files with 21 additions and 10 deletions
packages
backend/src/core
frontend/src/components
|
@ -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) {
|
||||
|
|
|
@ -100,4 +100,4 @@ function getReactionName(reaction: string): string {
|
|||
.more {
|
||||
padding-top: 4px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -112,4 +112,4 @@ watch([() => props.note.reactions, () => props.maxNumber], ([newSource, maxNumbe
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
Loading…
Add table
Reference in a new issue