summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-02-03 11:30:39 +0000
committerdakkar <dakkar@thenautilus.net>2024-02-03 11:30:39 +0000
commit7684f45a5e0394ec1b9d72a07eada96c9f801c4b (patch)
tree3a405a9e4fb90e5a2ee791eaf436f632778a0f5b /packages/backend/src/queue
parentsimpler json-isation (diff)
downloadsharkey-7684f45a5e0394ec1b9d72a07eada96c9f801c4b.tar.gz
sharkey-7684f45a5e0394ec1b9d72a07eada96c9f801c4b.tar.bz2
sharkey-7684f45a5e0394ec1b9d72a07eada96c9f801c4b.zip
simpler mapping
thanks Alina
Diffstat (limited to 'packages/backend/src/queue')
-rw-r--r--packages/backend/src/queue/processors/ImportNotesProcessorService.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts
index 0554566748..6e15edf970 100644
--- a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts
+++ b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts
@@ -187,14 +187,11 @@ export class ImportNotesProcessorService {
this.logger.succ(`Unzipping to ${outputPath}`);
ZipReader.withDestinationPath(outputPath).viaBuffer(await fs.promises.readFile(destPath));
- const unprocessedTweetJson = this.parseTwitterFile(fs.readFileSync(outputPath + '/data/tweets.js', 'utf-8'));
+ const unprocessedTweets = this.parseTwitterFile(fs.readFileSync(outputPath + '/data/tweets.js', 'utf-8'));
//Make sure that it isnt null (because if something went wrong in parseTwitterFile it returns null)
if (unprocessedTweetJson) {
- const tweets = Object.keys(unprocessedTweetJson).reduce((m, key, i, obj) => {
- return m.concat(unprocessedTweetJson[i].tweet);
- }, []);
-
+ const tweets = unprocessedTweets.map(e=>e.tweet);
const processedTweets = await this.recreateChain(['id_str'], ['in_reply_to_status_id_str'], tweets, false);
this.queueService.createImportTweetsToDbJob(job.data.user, processedTweets, null);
} else {