enhance(backend): チャンネルの既読管理を削除
- 現状上手く機能していない - パフォーマンス上の理由 - 実装するにしてももっと効率的な方法がある
This commit is contained in:
parent
ecaf152b4a
commit
625fed8838
9 changed files with 6 additions and 101 deletions
|
@ -234,18 +234,6 @@ export class UserEntityService implements OnModuleInit {
|
|||
return false; // TODO
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async getHasUnreadChannel(userId: User['id']): Promise<boolean> {
|
||||
const channels = await this.channelFollowingsRepository.findBy({ followerId: userId });
|
||||
|
||||
const unread = channels.length > 0 ? await this.noteUnreadsRepository.findOneBy({
|
||||
userId: userId,
|
||||
noteChannelId: In(channels.map(x => x.followeeId)),
|
||||
}) : null;
|
||||
|
||||
return unread != null;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async getHasUnreadNotification(userId: User['id']): Promise<boolean> {
|
||||
const latestReadNotificationId = await this.redisClient.get(`latestReadNotification:${userId}`);
|
||||
|
@ -463,7 +451,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
}).then(count => count > 0),
|
||||
hasUnreadAnnouncement: this.getHasUnreadAnnouncement(user.id),
|
||||
hasUnreadAntenna: this.getHasUnreadAntenna(user.id),
|
||||
hasUnreadChannel: this.getHasUnreadChannel(user.id),
|
||||
hasUnreadChannel: false, // 後方互換性のため
|
||||
hasUnreadNotification: this.getHasUnreadNotification(user.id),
|
||||
hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id),
|
||||
mutedWords: profile!.mutedWords,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue