summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2024-06-22 19:49:38 +0900
committerGitHub <noreply@github.com>2024-06-22 19:49:38 +0900
commit961cb6c5eeb7745dc156327d2041241b70098b70 (patch)
tree46b78294870a09444337eaba77a36e20183a5c1b /packages/backend/src/core
parentRemove @types/node-fetch (#13948) (diff)
downloadmisskey-961cb6c5eeb7745dc156327d2041241b70098b70.tar.gz
misskey-961cb6c5eeb7745dc156327d2041241b70098b70.tar.bz2
misskey-961cb6c5eeb7745dc156327d2041241b70098b70.zip
fix(backend): fix creating reactions bugs (#13901)
* fix(backend): add fallback for empty string when creating reaction * fix(backend): prohibit reactions to Renote * test(backend): add some tests for `notes/reactions/create` endpoint * Update CHANGELOG.md * lint * Update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/ReactionService.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts
index cb0b079df0..64c7b2ed03 100644
--- a/packages/backend/src/core/ReactionService.ts
+++ b/packages/backend/src/core/ReactionService.ts
@@ -29,6 +29,7 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
import { RoleService } from '@/core/RoleService.js';
import { FeaturedService } from '@/core/FeaturedService.js';
import { trackPromise } from '@/misc/promise-tracker.js';
+import { isQuote, isRenote } from '@/misc/is-renote.js';
const FALLBACK = '\u2764';
const PER_NOTE_REACTION_USER_PAIR_CACHE_MAX = 16;
@@ -117,11 +118,16 @@ export class ReactionService {
throw new IdentifiableError('68e9d2d1-48bf-42c2-b90a-b20e09fd3d48', 'Note not accessible for you.');
}
+ // Check if note is Renote
+ if (isRenote(note) && !isQuote(note)) {
+ throw new IdentifiableError('12c35529-3c79-4327-b1cc-e2cf63a71925', 'You cannot react to Renote.');
+ }
+
let reaction = _reaction ?? FALLBACK;
if (note.reactionAcceptance === 'likeOnly' || ((note.reactionAcceptance === 'likeOnlyForRemote' || note.reactionAcceptance === 'nonSensitiveOnlyForLocalLikeOnlyForRemote') && (user.host != null))) {
reaction = '\u2764';
- } else if (_reaction) {
+ } else if (_reaction != null) {
const custom = reaction.match(isCustomEmojiRegexp);
if (custom) {
const reacterHost = this.utilityService.toPunyNullable(user.host);