feat: isIndexable

This commit is contained in:
Mar0xy 2023-11-07 19:16:57 +01:00
parent 53f2089116
commit 9cd2759769
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
15 changed files with 48 additions and 4 deletions

View file

@ -223,8 +223,7 @@ export class NoteCreateService implements OnApplicationShutdown {
username: MiUser['username'];
host: MiUser['host'];
isBot: MiUser['isBot'];
isCat: MiUser['isCat'];
speakAsCat: MiUser['speakAsCat'];
isIndexable: MiUser['isIndexable'];
}, data: Option, silent = false): Promise<MiNote> {
// チャンネル外にリプライしたら対象のスコープに合わせる
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
@ -482,6 +481,7 @@ export class NoteCreateService implements OnApplicationShutdown {
username: MiUser['username'];
host: MiUser['host'];
isBot: MiUser['isBot'];
isIndexable: MiUser['isIndexable'];
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
const meta = await this.metaService.fetch();
@ -712,7 +712,7 @@ export class NoteCreateService implements OnApplicationShutdown {
}
// Register to search database
this.index(note);
if (user.isIndexable) this.index(note);
}
@bindThis

View file

@ -224,6 +224,7 @@ export class NoteEditService implements OnApplicationShutdown {
username: MiUser['username'];
host: MiUser['host'];
isBot: MiUser['isBot'];
isIndexable: MiUser['isIndexable'];
}, editid: MiNote['id'], data: Option, silent = false): Promise<MiNote> {
if (!editid) {
throw new Error('fail');
@ -498,6 +499,7 @@ export class NoteEditService implements OnApplicationShutdown {
username: MiUser['username'];
host: MiUser['host'];
isBot: MiUser['isBot'];
isIndexable: MiUser['isIndexable'];
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
// Register host
if (this.userEntityService.isRemoteUser(user)) {
@ -686,7 +688,7 @@ export class NoteEditService implements OnApplicationShutdown {
}
// Register to search database
this.index(note);
if (user.isIndexable) this.index(note);
}
@bindThis

View file

@ -506,6 +506,7 @@ export class ApRendererService {
discoverable: user.isExplorable,
publicKey: this.renderKey(user, keypair, '#main-key'),
isCat: user.isCat,
isIndexable: user.isIndexable,
speakAsCat: user.speakAsCat,
attachment: attachment.length ? attachment : undefined,
};

View file

@ -310,6 +310,7 @@ export class ApPersonService implements OnModuleInit {
backgroundId: null,
lastFetchedAt: new Date(),
name: truncate(person.name, nameLength),
isIndexable: person.isIndexable ?? true,
isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo,
movedAt: person.movedTo ? new Date() : null,
@ -476,6 +477,7 @@ export class ApPersonService implements OnModuleInit {
isBot: getApType(object) === 'Service' || getApType(object) === 'Application',
isCat: (person as any).isCat === true,
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
isIndexable: person.isIndexable ?? true,
isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo ?? null,
alsoKnownAs: person.alsoKnownAs ?? null,

View file

@ -184,6 +184,7 @@ export interface IActor extends IObject {
};
'vcard:bday'?: string;
'vcard:Address'?: string;
isIndexable?: boolean;
listenbrainz?: string;
backgroundUrl?: string;
}

View file

@ -399,6 +399,7 @@ export class UserEntityService implements OnModuleInit {
}))) : [],
isBot: user.isBot,
isCat: user.isCat,
isIndexable: user.isIndexable,
isSilenced: user.isSilenced || this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote),
speakAsCat: user.speakAsCat ?? false,
approved: user.approved,