account for akkoma local-only post visibility
This commit is contained in:
parent
81988aeaea
commit
b20b007579
1 changed files with 14 additions and 2 deletions
|
|
@ -22,6 +22,7 @@ import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js';
|
|||
import { extractApHashtagObjects } from '@/core/activitypub/models/tag.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type { DbNoteImportToDbJobData, DbNoteImportJobData, DbNoteWithParentImportToDbJobData } from '../types.js';
|
||||
import type { Config } from '@/config.js';
|
||||
|
|
@ -54,6 +55,7 @@ export class ImportNotesProcessorService {
|
|||
private downloadService: DownloadService,
|
||||
private idService: IdService,
|
||||
private queueLoggerService: QueueLoggerService,
|
||||
private utilityService: UtilityService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('import-notes');
|
||||
}
|
||||
|
|
@ -449,7 +451,17 @@ export class ImportNotesProcessorService {
|
|||
|
||||
if (post.directMessage) return;
|
||||
|
||||
const visibility = post.to.includes('https://www.w3.org/ns/activitystreams#Public') ? 'public' : post.cc.includes('https://www.w3.org/ns/activitystreams#Public') ? 'home' : 'followers';
|
||||
let visibility = 'followers';
|
||||
let localOnly = false;
|
||||
|
||||
// akkoma implementation of local-only: true if the to field includes "http://instance.domain/#Public"
|
||||
if (post.to.includes('https://' + this.utilityService.extractDbHost(post.actor) + '/#Public')) {
|
||||
visibility = 'home';
|
||||
localOnly = true;
|
||||
} else {
|
||||
visibility = post.to.includes('https://www.w3.org/ns/activitystreams#Public') ? 'public' : post.cc.includes('https://www.w3.org/ns/activitystreams#Public') ? 'home' : 'followers';
|
||||
localOnly = false;
|
||||
}
|
||||
|
||||
const date = new Date(post.object.published);
|
||||
let text = undefined;
|
||||
|
|
@ -518,7 +530,7 @@ export class ImportNotesProcessorService {
|
|||
}
|
||||
}
|
||||
|
||||
const createdNote = await this.noteCreateService.import(user, { createdAt: date, text: text, files: files, visibility: visibility, apMentions: new Array(0), cw: post.object.sensitive ? post.object.summary : null, reply: reply });
|
||||
const createdNote = await this.noteCreateService.import(user, { createdAt: date, text: text, files: files, visibility: visibility, localOnly: localOnly, apMentions: new Array(0), cw: post.object.sensitive ? post.object.summary : null, reply: reply });
|
||||
if (post.childNotes) this.queueService.createImportPleroToDbJob(user, post.childNotes, createdNote.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue