diff --git a/packages/backend/src/misc/check-hit-antenna.ts b/packages/backend/src/misc/check-hit-antenna.ts index 1ff09d629..3ec019273 100644 --- a/packages/backend/src/misc/check-hit-antenna.ts +++ b/packages/backend/src/misc/check-hit-antenna.ts @@ -1,11 +1,7 @@ import type { Antenna } from "@/models/entities/antenna.js"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; -import { - UserListJoinings, - UserGroupJoinings, - Blockings, -} from "@/models/index.js"; +import { Blockings } from "@/models/index.js"; import { getFullApAccount } from "./convert-host.js"; import * as Acct from "@/misc/acct.js"; import type { Packed } from "./schema.js"; @@ -13,17 +9,10 @@ import { Cache } from "./cache.js"; const blockingCache = new Cache("blocking", 60 * 5); -// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている - -/** - * noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい - */ export async function checkHitAntenna( antenna: Antenna, note: Note | Packed<"Note">, noteUser: { id: User["id"]; username: string; host: string | null }, - noteUserFollowers?: User["id"][], - antennaUserFollowing?: User["id"][], ): Promise { if (note.visibility === "specified") return false; if (note.visibility === "home") return false; @@ -36,41 +25,9 @@ export async function checkHitAntenna( ); if (blockings.some((blocking) => blocking === antenna.userId)) return false; - if (note.visibility === "followers") { - if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) - return false; - if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) - return false; - } - if (!antenna.withReplies && note.replyId != null) return false; - if (antenna.src === "home") { - if (noteUserFollowers && !noteUserFollowers.includes(antenna.userId)) - return false; - if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) - return false; - } else if (antenna.src === "list") { - const listUsers = ( - await UserListJoinings.findBy({ - userListId: antenna.userListId!, - }) - ).map((x) => x.userId); - - if (!listUsers.includes(note.userId)) return false; - } else if (antenna.src === "group") { - const joining = await UserGroupJoinings.findOneByOrFail({ - id: antenna.userGroupJoiningId!, - }); - - const groupUsers = ( - await UserGroupJoinings.findBy({ - userGroupId: joining.userGroupId, - }) - ).map((x) => x.userId); - - if (!groupUsers.includes(note.userId)) return false; - } else if (antenna.src === "users") { + if (antenna.src === "users") { const accts = antenna.users.map((x) => { const { username, host } = Acct.parse(x); return getFullApAccount(username, host).toLowerCase(); diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index 632cb960e..f4891ff98 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -1,6 +1,6 @@ import * as mfm from "mfm-js"; -import es from "../../db/elasticsearch.js"; -import sonic from "../../db/sonic.js"; +import es from "@/db/elasticsearch.js"; +import sonic from "@/db/sonic.js"; import { publishMainStream, publishNotesStream, diff --git a/packages/backend/src/services/note/read.ts b/packages/backend/src/services/note/read.ts index 5e61fe95d..07d277d84 100644 --- a/packages/backend/src/services/note/read.ts +++ b/packages/backend/src/services/note/read.ts @@ -9,8 +9,6 @@ import { } from "@/models/index.js"; import { Not, IsNull, In } from "typeorm"; import type { Channel } from "@/models/entities/channel.js"; -import { checkHitAntenna } from "@/misc/check-hit-antenna.js"; -import { getAntennas } from "@/misc/antenna-cache.js"; import { readNotificationByQuery } from "@/server/api/common/read-notification.js"; import type { Packed } from "@/misc/schema.js"; @@ -66,23 +64,6 @@ export default async function ( if (note.channelId && followingChannels.has(note.channelId)) { readChannelNotes.push(note); } - - // if (note.user != null) { - // // たぶんnullになることは無いはずだけど一応 - // for (const antenna of myAntennas) { - // if ( - // await checkHitAntenna( - // antenna, - // note, - // note.user, - // undefined, - // Array.from(following), - // ) - // ) { - // readAntennaNotes.push(note); - // } - // } - // } } if (