summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteCreateService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-11-05 18:18:35 +0900
committerGitHub <noreply@github.com>2023-11-05 18:18:35 +0900
commit0c2dd335930298be37e7c81e0f5a8ab4c3964299 (patch)
treeb80975182254ab4bd6669b9ad417beca4d85d1ef /packages/backend/src/core/NoteCreateService.ts
parentMerge pull request #12060 from misskey-dev/develop (diff)
parent2023.11.0 (diff)
downloadmisskey-0c2dd335930298be37e7c81e0f5a8ab4c3964299.tar.gz
misskey-0c2dd335930298be37e7c81e0f5a8ab4c3964299.tar.bz2
misskey-0c2dd335930298be37e7c81e0f5a8ab4c3964299.zip
Merge pull request #12177 from misskey-dev/develop
Release: 2023.11.0
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
-rw-r--r--packages/backend/src/core/NoteCreateService.ts36
1 files changed, 24 insertions, 12 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 364a300d23..acd11a9fa7 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';
@@ -99,17 +100,14 @@ class NotificationManager {
}
@bindThis
- public async deliver() {
+ public async notify() {
for (const x of this.queue) {
- // ミュート情報を取得
- const mentioneeMutes = await this.mutingsRepository.findBy({
- muterId: x.target,
- });
-
- const mentioneesMutedUserIds = mentioneeMutes.map(m => m.muteeId);
-
- // 通知される側のユーザーが通知する側のユーザーをミュートしていない限りは通知する
- if (!mentioneesMutedUserIds.includes(this.notifier.id)) {
+ if (x.reason === 'renote') {
+ this.notificationService.createNotification(x.target, 'renote', {
+ noteId: this.note.id,
+ targetNoteId: this.note.renoteId!,
+ }, this.notifier.id);
+ } else {
this.notificationService.createNotification(x.target, x.reason, {
noteId: this.note.id,
}, this.notifier.id);
@@ -216,6 +214,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private activeUsersChart: ActiveUsersChart,
private instanceChart: InstanceChart,
private utilityService: UtilityService,
+ private userBlockingService: UserBlockingService,
) { }
@bindThis
@@ -292,6 +291,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';
@@ -628,7 +639,7 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
- nm.deliver();
+ nm.notify();
//#region AP deliver
if (this.userEntityService.isLocalUser(user)) {
@@ -825,6 +836,7 @@ export class NoteCreateService implements OnApplicationShutdown {
@bindThis
private async pushToTl(note: MiNote, user: { id: MiUser['id']; host: MiUser['host']; }) {
const meta = await this.metaService.fetch();
+ if (!meta.enableFanoutTimeline) return;
const r = this.redisForTimelines.pipeline();
@@ -868,7 +880,7 @@ export class NoteCreateService implements OnApplicationShutdown {
if (note.visibility === 'followers') {
// TODO: 重そうだから何とかしたい Set 使う?
- userListMemberships = userListMemberships.filter(x => followings.some(f => f.followerId === x.userListUserId));
+ userListMemberships = userListMemberships.filter(x => x.userListUserId === user.id || followings.some(f => f.followerId === x.userListUserId));
}
// TODO: あまりにも数が多いと redisPipeline.exec に失敗する(理由は不明)ため、3万件程度を目安に分割して実行するようにする