mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-28 04:50:17 +01:00
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/807 Closes #823 Approved-by: Marie <github@yuugi.dev> Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
commit
943c6414d8
8 changed files with 22 additions and 4 deletions
|
@ -0,0 +1,11 @@
|
|||
export class AlterUserHideOnlineStatusDefaultTrue1733754069260 {
|
||||
name = 'AlterUserHideOnlineStatusDefaultTrue1733754069260'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "hideOnlineStatus" SET DEFAULT true`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "hideOnlineStatus" SET DEFAULT false`);
|
||||
}
|
||||
}
|
|
@ -528,6 +528,7 @@ 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,
|
||||
speakAsCat: user.speakAsCat,
|
||||
|
|
|
@ -564,6 +564,7 @@ const extension_context_definition = {
|
|||
speakAsCat: 'firefish:speakAsCat',
|
||||
// Sharkey
|
||||
sharkey: 'https://joinsharkey.org/ns#',
|
||||
hideOnlineStatus: 'sharkey:hideOnlineStatus',
|
||||
backgroundUrl: 'sharkey:backgroundUrl',
|
||||
listenbrainz: 'sharkey:listenbrainz',
|
||||
// vcard
|
||||
|
|
|
@ -389,6 +389,8 @@ export class ApPersonService implements OnModuleInit {
|
|||
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,
|
||||
|
@ -585,6 +587,8 @@ export class ApPersonService implements OnModuleInit {
|
|||
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'>;
|
||||
|
|
|
@ -215,6 +215,7 @@ export interface IActor extends IObject {
|
|||
};
|
||||
'vcard:bday'?: string;
|
||||
'vcard:Address'?: string;
|
||||
hideOnlineStatus?: boolean;
|
||||
noindex?: boolean;
|
||||
listenbrainz?: string;
|
||||
backgroundUrl?: string;
|
||||
|
|
|
@ -32,7 +32,7 @@ export class MiUser {
|
|||
public lastActiveDate: Date | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
default: true,
|
||||
})
|
||||
public hideOnlineStatus: boolean;
|
||||
|
||||
|
@ -160,7 +160,7 @@ export class MiUser {
|
|||
length: 128, nullable: true,
|
||||
})
|
||||
public backgroundBlurhash: string | null;
|
||||
|
||||
|
||||
@Column('jsonb', {
|
||||
default: [],
|
||||
})
|
||||
|
|
|
@ -587,7 +587,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
// these two methods need to be kept in sync with
|
||||
// `ApRendererService.renderPerson`
|
||||
private userNeedsPublishing(oldUser: MiLocalUser, newUser: Partial<MiUser>): boolean {
|
||||
for (const field of ['avatarId', 'bannerId', 'backgroundId', 'isBot', 'username', 'name', 'isLocked', 'isExplorable', 'isCat', 'noindex', 'speakAsCat', 'movedToUri', 'alsoKnownAs'] as (keyof MiUser)[]) {
|
||||
for (const field of ['avatarId', 'bannerId', 'backgroundId', 'isBot', 'username', 'name', 'isLocked', 'isExplorable', 'isCat', 'noindex', 'speakAsCat', 'movedToUri', 'alsoKnownAs', 'hideOnlineStatus'] as (keyof MiUser)[]) {
|
||||
if ((field in newUser) && oldUser[field] !== newUser[field]) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import MkFolder from '@/components/MkFolder.vue';
|
|||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
|
||||
const isLocked = ref(false);
|
||||
const hideOnlineStatus = ref(false);
|
||||
const hideOnlineStatus = ref(true);
|
||||
const noCrawle = ref(false);
|
||||
|
||||
watch([isLocked, hideOnlineStatus, noCrawle], () => {
|
||||
|
|
Loading…
Reference in a new issue