summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authoratsuchan <83960488+atsu1125@users.noreply.github.com>2023-10-23 16:42:26 +0900
committerGitHub <noreply@github.com>2023-10-23 16:42:26 +0900
commit9d0648ed357f7b16b2a1f9fb4f4526232c64dd41 (patch)
treef2c66e27b110f9f9290c02f140e745b7b4a1cf5e /packages/backend/src/core
parentUpdate CHANGELOG.md (diff)
downloadsharkey-9d0648ed357f7b16b2a1f9fb4f4526232c64dd41.tar.gz
sharkey-9d0648ed357f7b16b2a1f9fb4f4526232c64dd41.tar.bz2
sharkey-9d0648ed357f7b16b2a1f9fb4f4526232c64dd41.zip
enhance(server): Improve user block (Renote Part) (#12089)
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/NoteCreateService.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index ba2ead4f83..6caa3d463c 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -56,6 +56,7 @@ import { SearchService } from '@/core/SearchService.js';
import { FeaturedService } from '@/core/FeaturedService.js';
import { FunoutTimelineService } from '@/core/FunoutTimelineService.js';
import { UtilityService } from '@/core/UtilityService.js';
+import { UserBlockingService } from '@/core/UserBlockingService.js';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@@ -216,6 +217,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private activeUsersChart: ActiveUsersChart,
private instanceChart: InstanceChart,
private utilityService: UtilityService,
+ private userBlockingService: UserBlockingService,
) { }
@bindThis
@@ -292,6 +294,18 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
+ // Check blocking
+ if (data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length === 0)) {
+ if (data.renote.userHost === null) {
+ if (data.renote.userId !== user.id) {
+ const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id);
+ if (blocked) {
+ throw new Error('blocked');
+ }
+ }
+ }
+ }
+
// 返信対象がpublicではないならhomeにする
if (data.reply && data.reply.visibility !== 'public' && data.visibility === 'public') {
data.visibility = 'home';