From e4a1dd79afeff12d5abfebadd052eda4351bb345 Mon Sep 17 00:00:00 2001 From: mai <74494945+chan-mai@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:12:31 +0000 Subject: [PATCH 1/2] =?UTF-8?q?enhance:=20=E3=83=95=E3=82=A9=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=81=AA=E3=82=89=E9=8D=B5=E3=83=8E=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=A7=E3=82=82=E3=82=A2=E3=83=B3=E3=83=86=E3=83=8A?= =?UTF-8?q?=E3=81=AB=E3=81=B2=E3=81=A3=E3=81=8B=E3=81=8B=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/AntennaService.ts | 23 ++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts index e827ffa68c0f..dabd1bb27b04 100644 --- a/packages/backend/src/core/AntennaService.ts +++ b/packages/backend/src/core/AntennaService.ts @@ -12,7 +12,7 @@ import { GlobalEventService } from '@/core/GlobalEventService.js'; import * as Acct from '@/misc/acct.js'; import type { Packed } from '@/misc/json-schema.js'; import { DI } from '@/di-symbols.js'; -import type { AntennasRepository, UserListMembershipsRepository } from '@/models/_.js'; +import type { AntennasRepository, UserListMembershipsRepository, FollowingsRepository } from '@/models/_.js'; import { UtilityService } from '@/core/UtilityService.js'; import { bindThis } from '@/decorators.js'; import type { GlobalEvents } from '@/core/GlobalEventService.js'; @@ -37,6 +37,9 @@ export class AntennaService implements OnApplicationShutdown { @Inject(DI.userListMembershipsRepository) private userListMembershipsRepository: UserListMembershipsRepository, + @Inject(DI.followingsRepository) + private followingsRepository: FollowingsRepository, + private utilityService: UtilityService, private globalEventService: GlobalEventService, private fanoutTimelineService: FanoutTimelineService, @@ -111,8 +114,22 @@ export class AntennaService implements OnApplicationShutdown { @bindThis public async checkHitAntenna(antenna: MiAntenna, note: (MiNote | Packed<'Note'>), noteUser: { id: MiUser['id']; username: string; host: string | null; isBot: boolean; }): Promise { - if (note.visibility === 'specified') return false; - if (note.visibility === 'followers') return false; + if (note.visibility === 'specified') { + if (note.userId !== antenna.userId) { + if (note.visibleUserIds == null) return false; + if (!note.visibleUserIds.includes(antenna.userId)) return false; + } + } + if (note.visibility === 'followers') { + const isFollowing = await this.followingsRepository.count({ + where: { + followerId: antenna.userId, + followeeId: note.userId, + }, + take: 1, + }).then(n => n > 0); + if (!isFollowing && antenna.userId !== note.userId) return false; + } if (antenna.excludeBots && noteUser.isBot) return false; From 849ac0b59ed4a88b74c6ea61f0f6fd95313b3eaa Mon Sep 17 00:00:00 2001 From: mai <74494945+chan-mai@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:12:50 +0000 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a6e3a8a93fc6..3bd19dec7ba8 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ - 誰がリアクションをしたのかを非表示にできる機能 https://github.com/team-shahu/misskey/pull/35 (https://github.com/team-shahu/misskey/commit/5b2923c8127336d7fd2ee39c76d16f8a30d1b9e1) - 任意のTLを非表示にできるように https://github.com/team-shahu/misskey/pull/36 - プロフィールからアクティビティとファイルを隠せるようにする https://github.com/team-shahu/misskey/pull/37 +- フォローしているユーザーなら鍵ノートでもアンテナにひっかかるように https://github.com/team-shahu/misskey/pull/38 ## Special Thanks - [Misskey](https://github.com/misskey-dev/misskey)