mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 06:00:21 +01:00
fix
This commit is contained in:
parent
288cce4a22
commit
a093c373c4
2 changed files with 21 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
import type { Blocking } from '@/models/entities/Blocking.js';
|
||||
|
@ -17,10 +18,13 @@ import { CacheService } from '@/core/CacheService.js';
|
|||
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||
|
||||
@Injectable()
|
||||
export class UserBlockingService {
|
||||
export class UserBlockingService implements OnModuleInit {
|
||||
private logger: Logger;
|
||||
private userFollowingService: UserFollowingService;
|
||||
|
||||
constructor(
|
||||
private moduleRef: ModuleRef,
|
||||
|
||||
@Inject(DI.followRequestsRepository)
|
||||
private followRequestsRepository: FollowRequestsRepository,
|
||||
|
||||
|
@ -34,7 +38,6 @@ export class UserBlockingService {
|
|||
private userListJoiningsRepository: UserListJoiningsRepository,
|
||||
|
||||
private cacheService: CacheService,
|
||||
private userFollowingService: UserFollowingService,
|
||||
private userEntityService: UserEntityService,
|
||||
private idService: IdService,
|
||||
private queueService: QueueService,
|
||||
|
@ -46,6 +49,10 @@ export class UserBlockingService {
|
|||
this.logger = this.loggerService.getLogger('user-block');
|
||||
}
|
||||
|
||||
onModuleInit() {
|
||||
this.userFollowingService = this.moduleRef.get('UserFollowingService');
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async block(blocker: User, blockee: User) {
|
||||
await Promise.all([
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, OnModuleInit, forwardRef } from '@nestjs/common';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import type { LocalUser, RemoteUser, User } from '@/models/entities/User.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
|
@ -37,8 +38,12 @@ type Remote = RemoteUser | {
|
|||
type Both = Local | Remote;
|
||||
|
||||
@Injectable()
|
||||
export class UserFollowingService {
|
||||
export class UserFollowingService implements OnModuleInit {
|
||||
private userBlockingService: UserBlockingService;
|
||||
|
||||
constructor(
|
||||
private moduleRef: ModuleRef,
|
||||
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
||||
|
@ -56,7 +61,6 @@ export class UserFollowingService {
|
|||
|
||||
private cacheService: CacheService,
|
||||
private userEntityService: UserEntityService,
|
||||
private userBlockingService: UserBlockingService,
|
||||
private idService: IdService,
|
||||
private queueService: QueueService,
|
||||
private globalEventService: GlobalEventService,
|
||||
|
@ -70,6 +74,10 @@ export class UserFollowingService {
|
|||
) {
|
||||
}
|
||||
|
||||
onModuleInit() {
|
||||
this.userBlockingService = this.moduleRef.get('UserBlockingService');
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async follow(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string): Promise<void> {
|
||||
const [follower, followee] = await Promise.all([
|
||||
|
|
Loading…
Reference in a new issue