mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-09 03:23:08 +02:00
simpler mapping
thanks Alina
This commit is contained in:
parent
25948c9232
commit
7684f45a5e
1 changed files with 2 additions and 5 deletions
|
@ -187,14 +187,11 @@ export class ImportNotesProcessorService {
|
||||||
this.logger.succ(`Unzipping to ${outputPath}`);
|
this.logger.succ(`Unzipping to ${outputPath}`);
|
||||||
ZipReader.withDestinationPath(outputPath).viaBuffer(await fs.promises.readFile(destPath));
|
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)
|
//Make sure that it isnt null (because if something went wrong in parseTwitterFile it returns null)
|
||||||
if (unprocessedTweetJson) {
|
if (unprocessedTweetJson) {
|
||||||
const tweets = Object.keys(unprocessedTweetJson).reduce((m, key, i, obj) => {
|
const tweets = unprocessedTweets.map(e=>e.tweet);
|
||||||
return m.concat(unprocessedTweetJson[i].tweet);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const processedTweets = await this.recreateChain(['id_str'], ['in_reply_to_status_id_str'], tweets, false);
|
const processedTweets = await this.recreateChain(['id_str'], ['in_reply_to_status_id_str'], tweets, false);
|
||||||
this.queueService.createImportTweetsToDbJob(job.data.user, processedTweets, null);
|
this.queueService.createImportTweetsToDbJob(job.data.user, processedTweets, null);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue