summaryrefslogtreecommitdiff
path: root/src/queue/processors/db/import-following.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-04-13 01:43:22 +0900
committerGitHub <noreply@github.com>2019-04-13 01:43:22 +0900
commit987168b863c52d0548050ffbac569782bb9a8cef (patch)
treec9aa2243dcdcbd044688d201a51c601574bff259 /src/queue/processors/db/import-following.ts
parentFix bug (diff)
downloadmisskey-987168b863c52d0548050ffbac569782bb9a8cef.tar.gz
misskey-987168b863c52d0548050ffbac569782bb9a8cef.tar.bz2
misskey-987168b863c52d0548050ffbac569782bb9a8cef.zip
strictNullChecks (#4666)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
Diffstat (limited to 'src/queue/processors/db/import-following.ts')
-rw-r--r--src/queue/processors/db/import-following.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/queue/processors/db/import-following.ts b/src/queue/processors/db/import-following.ts
index aae24b22d6..8de3193e46 100644
--- a/src/queue/processors/db/import-following.ts
+++ b/src/queue/processors/db/import-following.ts
@@ -13,13 +13,19 @@ const logger = queueLogger.createSubLogger('import-following');
export async function importFollowing(job: Bull.Job, done: any): Promise<void> {
logger.info(`Importing following of ${job.data.user.id} ...`);
- const user = await Users.findOne({
- id: job.data.user.id
- });
+ const user = await Users.findOne(job.data.user.id);
+ if (user == null) {
+ done();
+ return;
+ }
const file = await DriveFiles.findOne({
id: job.data.fileId
});
+ if (file == null) {
+ done();
+ return;
+ }
const csv = await downloadTextFile(file.url);
@@ -31,11 +37,11 @@ export async function importFollowing(job: Bull.Job, done: any): Promise<void> {
try {
const { username, host } = parseAcct(line.trim());
- let target = isSelfHost(host) ? await Users.findOne({
+ let target = isSelfHost(host!) ? await Users.findOne({
host: null,
usernameLower: username.toLowerCase()
}) : await Users.findOne({
- host: toPuny(host),
+ host: toPuny(host!),
usernameLower: username.toLowerCase()
});