mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	enhance?: DeleteAccountServiceでユーザーを削除する際にuserChangeDeletedStateを発行する (#13382)
This commit is contained in:
		
							parent
							
								
									d834232232
								
							
						
					
					
						commit
						c0156b740b
					
				
					 4 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -128,6 +128,7 @@ export class CacheService implements OnApplicationShutdown {
 | 
				
			||||||
			const { type, body } = obj.message as GlobalEvents['internal']['payload'];
 | 
								const { type, body } = obj.message as GlobalEvents['internal']['payload'];
 | 
				
			||||||
			switch (type) {
 | 
								switch (type) {
 | 
				
			||||||
				case 'userChangeSuspendedState':
 | 
									case 'userChangeSuspendedState':
 | 
				
			||||||
 | 
									case 'userChangeDeletedState':
 | 
				
			||||||
				case 'remoteUserUpdated': {
 | 
									case 'remoteUserUpdated': {
 | 
				
			||||||
					const user = await this.usersRepository.findOneBy({ id: body.id });
 | 
										const user = await this.usersRepository.findOneBy({ id: body.id });
 | 
				
			||||||
					if (user == null) {
 | 
										if (user == null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import { QueueService } from '@/core/QueueService.js';
 | 
				
			||||||
import { UserSuspendService } from '@/core/UserSuspendService.js';
 | 
					import { UserSuspendService } from '@/core/UserSuspendService.js';
 | 
				
			||||||
import { DI } from '@/di-symbols.js';
 | 
					import { DI } from '@/di-symbols.js';
 | 
				
			||||||
import { bindThis } from '@/decorators.js';
 | 
					import { bindThis } from '@/decorators.js';
 | 
				
			||||||
 | 
					import { GlobalEventService } from '@/core/GlobalEventService.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable()
 | 
					@Injectable()
 | 
				
			||||||
export class DeleteAccountService {
 | 
					export class DeleteAccountService {
 | 
				
			||||||
| 
						 | 
					@ -18,6 +19,7 @@ export class DeleteAccountService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private userSuspendService: UserSuspendService,
 | 
							private userSuspendService: UserSuspendService,
 | 
				
			||||||
		private queueService: QueueService,
 | 
							private queueService: QueueService,
 | 
				
			||||||
 | 
							private globalEventService: GlobalEventService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,5 +41,7 @@ export class DeleteAccountService {
 | 
				
			||||||
		await this.usersRepository.update(user.id, {
 | 
							await this.usersRepository.update(user.id, {
 | 
				
			||||||
			isDeleted: true,
 | 
								isDeleted: true,
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.globalEventService.publishInternalEvent('userChangeDeletedState', { id: user.id, isDeleted: true });
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,6 +209,7 @@ type SerializedAll<T> = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface InternalEventTypes {
 | 
					export interface InternalEventTypes {
 | 
				
			||||||
	userChangeSuspendedState: { id: MiUser['id']; isSuspended: MiUser['isSuspended']; };
 | 
						userChangeSuspendedState: { id: MiUser['id']; isSuspended: MiUser['isSuspended']; };
 | 
				
			||||||
 | 
						userChangeDeletedState: { id: MiUser['id']; isDeleted: MiUser['isDeleted']; };
 | 
				
			||||||
	userTokenRegenerated: { id: MiUser['id']; oldToken: string; newToken: string; };
 | 
						userTokenRegenerated: { id: MiUser['id']; oldToken: string; newToken: string; };
 | 
				
			||||||
	remoteUserUpdated: { id: MiUser['id']; };
 | 
						remoteUserUpdated: { id: MiUser['id']; };
 | 
				
			||||||
	follow: { followerId: MiUser['id']; followeeId: MiUser['id']; };
 | 
						follow: { followerId: MiUser['id']; followeeId: MiUser['id']; };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,6 @@ export class ApInboxService {
 | 
				
			||||||
		private apPersonService: ApPersonService,
 | 
							private apPersonService: ApPersonService,
 | 
				
			||||||
		private apQuestionService: ApQuestionService,
 | 
							private apQuestionService: ApQuestionService,
 | 
				
			||||||
		private queueService: QueueService,
 | 
							private queueService: QueueService,
 | 
				
			||||||
		private cacheService: CacheService,
 | 
					 | 
				
			||||||
		private globalEventService: GlobalEventService,
 | 
							private globalEventService: GlobalEventService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		this.logger = this.apLoggerService.logger;
 | 
							this.logger = this.apLoggerService.logger;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue