refactor: 可読性のため一部でArray.prototype.at
を使うように (#11274)
* refactor: `Array.prototype.at`を使うように * fixup! refactor: `Array.prototype.at`を使うように
This commit is contained in:
@@ -3,7 +3,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||
import { IsNull, MoreThan } from 'typeorm';
|
||||
import { format as dateFormat } from 'date-fns';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { MutingsRepository, UsersRepository, BlockingsRepository } from '@/models/index.js';
|
||||
import type { MutingsRepository, UsersRepository, BlockingsRepository, Muting } from '@/models/index.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import type Logger from '@/logger.js';
|
||||
import { DriveService } from '@/core/DriveService.js';
|
||||
@@ -56,7 +56,7 @@ export class ExportMutingProcessorService {
|
||||
const stream = fs.createWriteStream(path, { flags: 'a' });
|
||||
|
||||
let exportedCount = 0;
|
||||
let cursor: any = null;
|
||||
let cursor: Muting['id'] | null = null;
|
||||
|
||||
while (true) {
|
||||
const mutes = await this.mutingsRepository.find({
|
||||
@@ -76,7 +76,7 @@ export class ExportMutingProcessorService {
|
||||
break;
|
||||
}
|
||||
|
||||
cursor = mutes[mutes.length - 1].id;
|
||||
cursor = mutes.at(-1)?.id ?? null;
|
||||
|
||||
for (const mute of mutes) {
|
||||
const u = await this.usersRepository.findOneBy({ id: mute.muteeId });
|
||||
|
Reference in New Issue
Block a user