This commit is contained in:
MeiMei 2019-12-12 00:46:10 +09:00 committed by syuilo
parent 43f3f8a058
commit 2a9de356db

View File

@ -30,7 +30,12 @@ export async function importUserLists(job: Bull.Job, done: any): Promise<void> {
const csv = await downloadTextFile(file.url);
let linenum = 0;
for (const line of csv.trim().split('\n')) {
linenum++;
try {
const listName = line.split(',')[0].trim();
const { username, host } = parseAcct(line.split(',')[1].trim());
@ -64,6 +69,9 @@ export async function importUserLists(job: Bull.Job, done: any): Promise<void> {
if (await UserListJoinings.findOne({ userListId: list.id, userId: target.id }) != null) continue;
pushUserToUserList(target, list);
} catch (e) {
logger.warn(`Error in line:${linenum} ${e}`);
}
}
logger.succ('Imported');