feat: export withReplies of following
This commit is contained in:
parent
752fea9e76
commit
75264e7bf7
|
@ -94,7 +94,8 @@ export class ExportFollowingProcessorService {
|
||||||
continue;
|
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) => {
|
await new Promise<void>((res, rej) => {
|
||||||
stream.write(content + '\n', err => {
|
stream.write(content + '\n', err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -67,8 +67,19 @@ export class ImportFollowingProcessorService {
|
||||||
const user = job.data.user;
|
const user = job.data.user;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const acct = line.split(',')[0].trim();
|
const parts = line.split(',');
|
||||||
|
const acct = parts[0].trim();
|
||||||
const { username, host } = Acct.parse(acct);
|
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;
|
if (!host) return;
|
||||||
|
|
||||||
|
@ -95,7 +106,7 @@ export class ImportFollowingProcessorService {
|
||||||
|
|
||||||
this.logger.info(`Follow ${target.id} ${job.data.withReplies ? 'with replies' : 'without replies'} ...`);
|
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) {
|
} catch (e) {
|
||||||
this.logger.warn(`Error: ${e}`);
|
this.logger.warn(`Error: ${e}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue