diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-03-08 08:56:47 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-08 08:56:47 +0900 |
| commit | dd6569a1bb025f2e295c9d19d870febcde712ea1 (patch) | |
| tree | 7ac4c4b1674c7aab27db9cf4b657bb2966e1e37d /packages/backend/src/core | |
| parent | feat: Per-user renote mute (#10249) (diff) | |
| download | sharkey-dd6569a1bb025f2e295c9d19d870febcde712ea1.tar.gz sharkey-dd6569a1bb025f2e295c9d19d870febcde712ea1.tar.bz2 sharkey-dd6569a1bb025f2e295c9d19d870febcde712ea1.zip | |
feat: Reaction acceptance (#10256)
* wip
* wip
* デフォルト設定
Diffstat (limited to 'packages/backend/src/core')
| -rw-r--r-- | packages/backend/src/core/NoteCreateService.ts | 2 | ||||
| -rw-r--r-- | packages/backend/src/core/ReactionService.ts | 8 | ||||
| -rw-r--r-- | packages/backend/src/core/entities/NoteEntityService.ts | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 4c4261ba79..8d8535ca5b 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -125,6 +125,7 @@ type Option = { files?: DriveFile[] | null; poll?: IPoll | null; localOnly?: boolean | null; + reactionAcceptance?: Note['reactionAcceptance']; cw?: string | null; visibility?: string; visibleUsers?: MinimumUser[] | null; @@ -346,6 +347,7 @@ export class NoteCreateService implements OnApplicationShutdown { emojis, userId: user.id, localOnly: data.localOnly!, + reactionAcceptance: data.reactionAcceptance, visibility: data.visibility as any, visibleUserIds: data.visibility === 'specified' ? data.visibleUsers diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts index 9fccc14ee4..3e644018d7 100644 --- a/packages/backend/src/core/ReactionService.ts +++ b/packages/backend/src/core/ReactionService.ts @@ -99,8 +99,12 @@ export class ReactionService { throw new IdentifiableError('68e9d2d1-48bf-42c2-b90a-b20e09fd3d48', 'Note not accessible for you.'); } - // TODO: cache - reaction = await this.toDbReaction(reaction, user.host); + if (note.reactionAcceptance === 'likeOnly' || ((note.reactionAcceptance === 'likeOnlyForRemote') && (user.host != null))) { + reaction = '❤️'; + } else { + // TODO: cache + reaction = await this.toDbReaction(reaction, user.host); + } const record: NoteReaction = { id: this.idService.genId(), diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 4ec10df9a6..67850ad9aa 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -314,6 +314,7 @@ export class NoteEntityService implements OnModuleInit { cw: note.cw, visibility: note.visibility, localOnly: note.localOnly ?? undefined, + reactionAcceptance: note.reactionAcceptance, visibleUserIds: note.visibility === 'specified' ? note.visibleUserIds : undefined, renoteCount: note.renoteCount, repliesCount: note.repliesCount, |