Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
perf(backend): remove needless query
Browse files Browse the repository at this point in the history
#12206
  • Loading branch information
syuilo committed Nov 1, 2023
1 parent 5fb6847 commit 7ed2a5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- Enhance: フォローしているチャンネルをフォロー解除した時(またはその逆)、タイムラインに反映される間隔を改善
- Enhance: プロフィールの自己紹介欄のMFMが連合するようになりました
- 相手がMisskey v2023.11.0以降である必要があります
- Enhance: チャンネル取得時のパフォーマンスを向上
- Fix: リストTLに自分のフォロワー限定投稿が含まれない問題を修正
- Fix: ローカルタイムラインに投稿者自身の投稿への返信が含まれない問題を修正
- Fix: 自分のフォローしているユーザーの自分のフォローしていないユーザーの visibility: followers な投稿への返信がストリーミングで流れてくる問題を修正
Expand Down
15 changes: 2 additions & 13 deletions packages/backend/src/core/entities/ChannelEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js';
import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NoteUnreadsRepository, NotesRepository } from '@/models/_.js';
import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NotesRepository } from '@/models/_.js';
import type { Packed } from '@/misc/json-schema.js';
import type { } from '@/models/Blocking.js';
import type { MiUser } from '@/models/User.js';
Expand All @@ -14,7 +14,6 @@ import { bindThis } from '@/decorators.js';
import { IdService } from '@/core/IdService.js';
import { DriveFileEntityService } from './DriveFileEntityService.js';
import { NoteEntityService } from './NoteEntityService.js';
import { In } from 'typeorm';

@Injectable()
export class ChannelEntityService {
Expand All @@ -31,9 +30,6 @@ export class ChannelEntityService {
@Inject(DI.notesRepository)
private notesRepository: NotesRepository,

@Inject(DI.noteUnreadsRepository)
private noteUnreadsRepository: NoteUnreadsRepository,

@Inject(DI.driveFilesRepository)
private driveFilesRepository: DriveFilesRepository,

Expand All @@ -54,13 +50,6 @@ export class ChannelEntityService {

const banner = channel.bannerId ? await this.driveFilesRepository.findOneBy({ id: channel.bannerId }) : null;

const hasUnreadNote = meId ? await this.noteUnreadsRepository.exist({
where: {
noteChannelId: channel.id,
userId: meId,
},
}) : undefined;

const isFollowing = meId ? await this.channelFollowingsRepository.exist({
where: {
followerId: meId,
Expand Down Expand Up @@ -99,7 +88,7 @@ export class ChannelEntityService {
...(me ? {
isFollowing,
isFavorited,
hasUnreadNote,
hasUnreadNote: false, // 後方互換性のため
} : {}),

...(detailed ? {
Expand Down

0 comments on commit 7ed2a5f

Please sign in to comment.