upd: pass full thinuser

This commit is contained in:
Mar0xy 2023-11-12 15:48:28 +01:00
parent 2d1e8ee44d
commit b7fc13efb7
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
2 changed files with 10 additions and 14 deletions

View file

@ -950,16 +950,12 @@ export class NoteCreateService implements OnApplicationShutdown {
}); });
} }
if (!silent) {
if (this.userEntityService.isLocalUser(user)) this.activeUsersChart.write(user);
// Pack the note // Pack the note
const noteObj = await this.noteEntityService.pack(note, null, { skipHide: true, withReactionAndUserPairCache: true }); const noteObj = await this.noteEntityService.pack(note, null, { skipHide: true, withReactionAndUserPairCache: true });
this.globalEventService.publishNotesStream(noteObj); this.globalEventService.publishNotesStream(noteObj);
this.roleService.addNoteToRoleTimeline(noteObj); this.roleService.addNoteToRoleTimeline(noteObj);
}
if (data.channel) { if (data.channel) {
this.channelsRepository.increment({ id: data.channel.id }, 'notesCount', 1); this.channelsRepository.increment({ id: data.channel.id }, 'notesCount', 1);

View file

@ -136,7 +136,7 @@ export class ImportNotesProcessorService {
const tweets = Object.keys(fakeWindow.window.YTD.tweets.part0).reduce((m, key, i, obj) => { const tweets = Object.keys(fakeWindow.window.YTD.tweets.part0).reduce((m, key, i, obj) => {
return m.concat(fakeWindow.window.YTD.tweets.part0[key].tweet); return m.concat(fakeWindow.window.YTD.tweets.part0[key].tweet);
}, []).filter(this._keepTweet); }, []).filter(this._keepTweet);
this.queueService.createImportTweetsToDbJob({ id: user.id }, tweets); this.queueService.createImportTweetsToDbJob(job.data.user, tweets);
} finally { } finally {
cleanup(); cleanup();
} }
@ -167,7 +167,7 @@ export class ImportNotesProcessorService {
const postsJson = fs.readFileSync(outputPath + '/content/posts_1.json', 'utf-8'); const postsJson = fs.readFileSync(outputPath + '/content/posts_1.json', 'utf-8');
const posts = JSON.parse(postsJson); const posts = JSON.parse(postsJson);
await this.uploadFiles(outputPath + '/media/posts', user); await this.uploadFiles(outputPath + '/media/posts', user);
this.queueService.createImportIGToDbJob({ id: user.id }, posts); this.queueService.createImportIGToDbJob(job.data.user, posts);
} else if (isOutbox) { } else if (isOutbox) {
const actorJson = fs.readFileSync(outputPath + '/actor.json', 'utf-8'); const actorJson = fs.readFileSync(outputPath + '/actor.json', 'utf-8');
const actor = JSON.parse(actorJson); const actor = JSON.parse(actorJson);
@ -175,12 +175,12 @@ export class ImportNotesProcessorService {
if (isPleroma) { if (isPleroma) {
const outboxJson = fs.readFileSync(outputPath + '/outbox.json', 'utf-8'); const outboxJson = fs.readFileSync(outputPath + '/outbox.json', 'utf-8');
const outbox = JSON.parse(outboxJson); const outbox = JSON.parse(outboxJson);
this.queueService.createImportPleroToDbJob({ id: user.id }, outbox.orderedItems.filter((x: any) => x.type === 'Create' && x.object.type === 'Note')); this.queueService.createImportPleroToDbJob(job.data.user, outbox.orderedItems.filter((x: any) => x.type === 'Create' && x.object.type === 'Note'));
} else { } else {
const outboxJson = fs.readFileSync(outputPath + '/outbox.json', 'utf-8'); const outboxJson = fs.readFileSync(outputPath + '/outbox.json', 'utf-8');
const outbox = JSON.parse(outboxJson); const outbox = JSON.parse(outboxJson);
if (fs.existsSync(outputPath + '/media_attachments/files')) await this.uploadFiles(outputPath + '/media_attachments/files', user); if (fs.existsSync(outputPath + '/media_attachments/files')) await this.uploadFiles(outputPath + '/media_attachments/files', user);
this.queueService.createImportMastoToDbJob({ id: user.id }, outbox.orderedItems.filter((x: any) => x.type === 'Create' && x.object.type === 'Note')); this.queueService.createImportMastoToDbJob(job.data.user, outbox.orderedItems.filter((x: any) => x.type === 'Create' && x.object.type === 'Note'));
} }
} }
} finally { } finally {
@ -203,7 +203,7 @@ export class ImportNotesProcessorService {
const notesJson = fs.readFileSync(path, 'utf-8'); const notesJson = fs.readFileSync(path, 'utf-8');
const notes = JSON.parse(notesJson); const notes = JSON.parse(notesJson);
this.queueService.createImportKeyNotesToDbJob({ id: user.id }, notes); this.queueService.createImportKeyNotesToDbJob(job.data.user, notes);
cleanup(); cleanup();
} }