feat: export withReplies of following

This commit is contained in:
anatawa12 2025-05-08 00:24:31 +09:00
parent 752fea9e76
commit 75264e7bf7
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
2 changed files with 15 additions and 3 deletions

View File

@ -94,7 +94,8 @@ export class ExportFollowingProcessorService {
continue;
}
const content = this.utilityService.getFullApAccount(u.username, u.host);
const userAcct = this.utilityService.getFullApAccount(u.username, u.host);
const content = `${userAcct},withReplies=${following.withReplies}`;
await new Promise<void>((res, rej) => {
stream.write(content + '\n', err => {
if (err) {

View File

@ -67,8 +67,19 @@ export class ImportFollowingProcessorService {
const user = job.data.user;
try {
const acct = line.split(',')[0].trim();
const parts = line.split(',');
const acct = parts[0].trim();
const { username, host } = Acct.parse(acct);
let withReplies: boolean | null = null;
for (const keyValue of parts.slice(2)) {
const [key, value] = keyValue.split('=');
switch (key) {
case 'withReplies':
withReplies = value === 'true';
break;
}
}
if (!host) return;
@ -95,7 +106,7 @@ export class ImportFollowingProcessorService {
this.logger.info(`Follow ${target.id} ${job.data.withReplies ? 'with replies' : 'without replies'} ...`);
this.queueService.createFollowJob([{ from: user, to: { id: target.id }, silent: true, withReplies: job.data.withReplies }]);
await this.queueService.createFollowJob([{ from: user, to: { id: target.id }, silent: true, withReplies: withReplies ?? job.data.withReplies }]);
} catch (e) {
this.logger.warn(`Error: ${e}`);
}