From 168001271f694145977f0bf3db64921141583e5e Mon Sep 17 00:00:00 2001 From: Namekuji Date: Mon, 24 Jul 2023 13:46:48 -0400 Subject: [PATCH] chore: remove unused lines --- packages/backend/src/services/note/read.ts | 65 ---------------------- 1 file changed, 65 deletions(-) diff --git a/packages/backend/src/services/note/read.ts b/packages/backend/src/services/note/read.ts index 5e61fe95d8..a8d55a15e7 100644 --- a/packages/backend/src/services/note/read.ts +++ b/packages/backend/src/services/note/read.ts @@ -3,14 +3,10 @@ import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { NoteUnreads, - Users, - Followings, ChannelFollowings, } 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"; @@ -25,18 +21,6 @@ export default async function ( followingChannels: Set; }, ) { - const following = info?.following - ? info.following - : new Set( - ( - await Followings.find({ - where: { - followerId: userId, - }, - select: ["followeeId"], - }) - ).map((x) => x.followeeId), - ); const followingChannels = info?.followingChannels ? info.followingChannels : new Set( @@ -50,11 +34,9 @@ export default async function ( ).map((x) => x.followeeId), ); - // const myAntennas = (await getAntennas()).filter((a) => a.userId === userId); const readMentions: (Note | Packed<"Note">)[] = []; const readSpecifiedNotes: (Note | Packed<"Note">)[] = []; const readChannelNotes: (Note | Packed<"Note">)[] = []; - // const readAntennaNotes: (Note | Packed<"Note">)[] = []; for (const note of notes) { if (note.mentions?.includes(userId)) { @@ -66,23 +48,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 ( @@ -139,34 +104,4 @@ export default async function ( ]), }); } - - // if (readAntennaNotes.length > 0) { - // await AntennaNotes.update( - // { - // antennaId: In(myAntennas.map((a) => a.id)), - // noteId: In(readAntennaNotes.map((n) => n.id)), - // }, - // { - // read: true, - // }, - // ); - - // // TODO: まとめてクエリしたい - // for (const antenna of myAntennas) { - // const count = await AntennaNotes.countBy({ - // antennaId: antenna.id, - // read: false, - // }); - - // if (count === 0) { - // publishMainStream(userId, "readAntenna", antenna); - // } - // } - - // Users.getHasUnreadAntenna(userId).then((unread) => { - // if (!unread) { - // publishMainStream(userId, "readAllAntennas"); - // } - // }); - // } }