isMarkedAsClosed --> isSuspended
This commit is contained in:
		
							parent
							
								
									31abd2f59b
								
							
						
					
					
						commit
						96648b651e
					
				
					 5 changed files with 29 additions and 9 deletions
				
			
		|  | @ -6,6 +6,7 @@ ChangeLog | |||
| ### Breaking Chnages | ||||
| * お知らせがリセットされます。 | ||||
| * 通知がリセットされます。 | ||||
| * インスタンスの閉鎖情報がリセットされます。 | ||||
| * モデレーターがインスタンス設定を閲覧したり変更したりできなくなります(それらができるのはAdminのみになります)。 | ||||
| 	* モデレーターが出来るのは、ユーザーのサイレンス/凍結などに限られます。 | ||||
| 	* 従来と同じ権限を与えたい場合、モデレーターをAdminに設定することを検討してください(Adminは複数人設定可能です)。 | ||||
|  |  | |||
							
								
								
									
										18
									
								
								migration/1580331224276-v12-11.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								migration/1580331224276-v12-11.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| import {MigrationInterface, QueryRunner} from "typeorm"; | ||||
| 
 | ||||
| export class v12111580331224276 implements MigrationInterface { | ||||
|     name = 'v12111580331224276' | ||||
| 
 | ||||
|     public async up(queryRunner: QueryRunner): Promise<any> { | ||||
|         await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "isMarkedAsClosed"`, undefined); | ||||
|         await queryRunner.query(`ALTER TABLE "instance" ADD "isSuspended" boolean NOT NULL DEFAULT false`, undefined); | ||||
|         await queryRunner.query(`CREATE INDEX "IDX_34500da2e38ac393f7bb6b299c" ON "instance" ("isSuspended") `, undefined); | ||||
|     } | ||||
| 
 | ||||
|     public async down(queryRunner: QueryRunner): Promise<any> { | ||||
|         await queryRunner.query(`DROP INDEX "IDX_34500da2e38ac393f7bb6b299c"`, undefined); | ||||
|         await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "isSuspended"`, undefined); | ||||
|         await queryRunner.query(`ALTER TABLE "instance" ADD "isMarkedAsClosed" boolean NOT NULL DEFAULT false`, undefined); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -114,12 +114,13 @@ export class Instance { | |||
| 	public isNotResponding: boolean; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * このインスタンスが閉鎖済みとしてマークされているか | ||||
| 	 * このインスタンスへの配信を停止するか | ||||
| 	 */ | ||||
| 	@Index() | ||||
| 	@Column('boolean', { | ||||
| 		default: false | ||||
| 	}) | ||||
| 	public isMarkedAsClosed: boolean; | ||||
| 	public isSuspended: boolean; | ||||
| 
 | ||||
| 	@Column('varchar', { | ||||
| 		length: 64, nullable: true, default: null, | ||||
|  |  | |||
|  | @ -21,15 +21,15 @@ export default async (job: Bull.Job) => { | |||
| 		return 'skip (blocked)'; | ||||
| 	} | ||||
| 
 | ||||
| 	// closedなら中断
 | ||||
| 	const closedHosts = await Instances.find({ | ||||
| 	// isSuspendedなら中断
 | ||||
| 	const suspendedHosts = await Instances.find({ | ||||
| 		where: { | ||||
| 			isMarkedAsClosed: true | ||||
| 			isSuspended: true | ||||
| 		}, | ||||
| 		cache: 60 * 1000 | ||||
| 	}); | ||||
| 	if (closedHosts.map(x => x.host).includes(toPuny(host))) { | ||||
| 		return 'skip (closed)'; | ||||
| 	if (suspendedHosts.map(x => x.host).includes(toPuny(host))) { | ||||
| 		return 'skip (suspended)'; | ||||
| 	} | ||||
| 
 | ||||
| 	try { | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ export const meta = { | |||
| 			validator: $.str | ||||
| 		}, | ||||
| 
 | ||||
| 		isClosed: { | ||||
| 		isSuspended: { | ||||
| 			validator: $.bool | ||||
| 		}, | ||||
| 	} | ||||
|  | @ -28,6 +28,6 @@ export default define(meta, async (ps, me) => { | |||
| 	} | ||||
| 
 | ||||
| 	Instances.update({ host: toPuny(ps.host) }, { | ||||
| 		isMarkedAsClosed: ps.isClosed | ||||
| 		isSuspended: ps.isSuspended | ||||
| 	}); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue