refactor: prefix Mi for all entities (#11719)
* wip
* wip
* wip
* wip
* Update RepositoryModule.ts
* wip
* wip
* wip
* Revert "wip"
This reverts commit c1c13b37d2
.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
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';
|
||||
import type { MiUser } from '@/models/entities/User.js';
|
||||
import type { MiBlocking } from '@/models/entities/Blocking.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
@@ -58,7 +58,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async block(blocker: User, blockee: User, silent = false) {
|
||||
public async block(blocker: MiUser, blockee: MiUser, silent = false) {
|
||||
await Promise.all([
|
||||
this.cancelRequest(blocker, blockee, silent),
|
||||
this.cancelRequest(blockee, blocker, silent),
|
||||
@@ -74,7 +74,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||
blockerId: blocker.id,
|
||||
blockee,
|
||||
blockeeId: blockee.id,
|
||||
} as Blocking;
|
||||
} as MiBlocking;
|
||||
|
||||
await this.blockingsRepository.insert(blocking);
|
||||
|
||||
@@ -93,7 +93,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async cancelRequest(follower: User, followee: User, silent = false) {
|
||||
private async cancelRequest(follower: MiUser, followee: MiUser, silent = false) {
|
||||
const request = await this.followRequestsRepository.findOneBy({
|
||||
followeeId: followee.id,
|
||||
followerId: follower.id,
|
||||
@@ -143,7 +143,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async removeFromList(listOwner: User, user: User) {
|
||||
private async removeFromList(listOwner: MiUser, user: MiUser) {
|
||||
const userLists = await this.userListsRepository.findBy({
|
||||
userId: listOwner.id,
|
||||
});
|
||||
@@ -157,7 +157,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async unblock(blocker: User, blockee: User) {
|
||||
public async unblock(blocker: MiUser, blockee: MiUser) {
|
||||
const blocking = await this.blockingsRepository.findOneBy({
|
||||
blockerId: blocker.id,
|
||||
blockeeId: blockee.id,
|
||||
@@ -191,7 +191,7 @@ export class UserBlockingService implements OnModuleInit {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async checkBlocked(blockerId: User['id'], blockeeId: User['id']): Promise<boolean> {
|
||||
public async checkBlocked(blockerId: MiUser['id'], blockeeId: MiUser['id']): Promise<boolean> {
|
||||
return (await this.cacheService.userBlockingCache.fetch(blockerId)).has(blockeeId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user