mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-29 03:28:29 +01:00
parent
43f3f8a058
commit
2a9de356db
1 changed files with 36 additions and 28 deletions
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue