Merge branch 'develop' into feature/2024.10

This commit is contained in:
dakkar 2024-12-12 17:38:29 +00:00
commit b266a5f9f6
20 changed files with 93 additions and 13 deletions

View file

@ -135,6 +135,7 @@ export class SignupService {
isRoot: isTheFirstUser,
approved: isTheFirstUser || (opts.approved ?? !this.meta.approvalRequiredForSignup),
signupReason: reason,
enableRss: false,
}));
await transactionalEntityManager.save(new MiUserKeypair({

View file

@ -98,6 +98,7 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
approved: true,
signupReason: null,
noindex: false,
enableRss: true,
...override,
};
}
@ -214,6 +215,7 @@ function toPackedUserLite(user: MiUser, override?: Packed<'UserLite'>): Packed<'
isAdmin: false,
isSystem: false,
isSilenced: user.isSilenced,
enableRss: true,
...override,
};
}

View file

@ -531,8 +531,10 @@ export class ApRendererService {
discoverable: user.isExplorable,
publicKey: this.renderKey(user, keypair, '#main-key'),
isCat: user.isCat,
hideOnlineStatus: user.hideOnlineStatus,
noindex: user.noindex,
indexable: !user.noindex,
enableRss: user.enableRss,
speakAsCat: user.speakAsCat,
attachment: attachment.length ? attachment : undefined,
};

View file

@ -567,8 +567,10 @@ const extension_context_definition = {
speakAsCat: 'firefish:speakAsCat',
// Sharkey
sharkey: 'https://joinsharkey.org/ns#',
hideOnlineStatus: 'sharkey:hideOnlineStatus',
backgroundUrl: 'sharkey:backgroundUrl',
listenbrainz: 'sharkey:listenbrainz',
enableRss: 'sharkey:enableRss',
// vcard
vcard: 'http://www.w3.org/2006/vcard/ns#',
} satisfies Context;

View file

@ -391,10 +391,13 @@ export class ApPersonService implements OnModuleInit {
lastFetchedAt: new Date(),
name: truncate(person.name, nameLength),
noindex: (person as any).noindex ?? false,
enableRss: person.enableRss === true,
isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo,
movedAt: person.movedTo ? new Date() : null,
alsoKnownAs: person.alsoKnownAs,
// We use "!== false" to handle incorrect types, missing / null values, and "default to true" logic.
hideOnlineStatus: person.hideOnlineStatus !== false,
isExplorable: person.discoverable,
username: person.preferredUsername,
approved: true,
@ -593,9 +596,12 @@ export class ApPersonService implements OnModuleInit {
isCat: (person as any).isCat === true,
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
noindex: (person as any).noindex ?? false,
enableRss: person.enableRss === true,
isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo ?? null,
alsoKnownAs: person.alsoKnownAs ?? null,
// We use "!== false" to handle incorrect types, missing / null values, and "default to true" logic.
hideOnlineStatus: person.hideOnlineStatus !== false,
isExplorable: person.discoverable,
...(await this.resolveAvatarAndBanner(exist, person.icon, person.image, person.backgroundUrl).catch(() => ({}))),
} as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;

View file

@ -218,7 +218,9 @@ export interface IActor extends IObject {
};
'vcard:bday'?: string;
'vcard:Address'?: string;
hideOnlineStatus?: boolean;
noindex?: boolean;
enableRss?: boolean;
listenbrainz?: string;
backgroundUrl?: string;
}

View file

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