mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 05:23:09 +02:00
upd: completely change handling of indexable
This commit is contained in:
parent
902e5a81f9
commit
55ef4c4d93
12 changed files with 40 additions and 25 deletions
15
packages/backend/migration/1700228972000-update-indexable.js
Normal file
15
packages/backend/migration/1700228972000-update-indexable.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
export class UpdateIndexable1700228972000 {
|
||||||
|
name = 'UpdateIndexable1700228972000'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "user" RENAME COLUMN "isIndexable" TO "noindex"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "noindex" SET DEFAULT false`);
|
||||||
|
await queryRunner.query(`UPDATE "user" SET "noindex" = false WHERE "noindex" = true`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`UPDATE "user" SET "noindex" = true WHERE "noindex" = false`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "user" ALTER COLUMN "noindex" SET DEFAULT true`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "user" RENAME COLUMN "noindex" TO "isIndexable"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -223,7 +223,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
username: MiUser['username'];
|
username: MiUser['username'];
|
||||||
host: MiUser['host'];
|
host: MiUser['host'];
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isIndexable: MiUser['isIndexable'];
|
noindex: MiUser['noindex'];
|
||||||
}, data: Option, silent = false): Promise<MiNote> {
|
}, data: Option, silent = false): Promise<MiNote> {
|
||||||
// チャンネル外にリプライしたら対象のスコープに合わせる
|
// チャンネル外にリプライしたら対象のスコープに合わせる
|
||||||
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
|
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
|
||||||
|
@ -384,7 +384,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
username: MiUser['username'];
|
username: MiUser['username'];
|
||||||
host: MiUser['host'];
|
host: MiUser['host'];
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isIndexable: MiUser['isIndexable'];
|
noindex: MiUser['noindex'];
|
||||||
}, data: Option, silent = false): Promise<MiNote> {
|
}, data: Option, silent = false): Promise<MiNote> {
|
||||||
// チャンネル外にリプライしたら対象のスコープに合わせる
|
// チャンネル外にリプライしたら対象のスコープに合わせる
|
||||||
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
|
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
|
||||||
|
@ -642,7 +642,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
username: MiUser['username'];
|
username: MiUser['username'];
|
||||||
host: MiUser['host'];
|
host: MiUser['host'];
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isIndexable: MiUser['isIndexable'];
|
noindex: MiUser['noindex'];
|
||||||
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
|
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
|
|
||||||
|
@ -873,7 +873,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register to search database
|
// Register to search database
|
||||||
if (user.isIndexable) this.index(note);
|
if (!user.noindex) this.index(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -882,7 +882,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
username: MiUser['username'];
|
username: MiUser['username'];
|
||||||
host: MiUser['host'];
|
host: MiUser['host'];
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isIndexable: MiUser['isIndexable'];
|
noindex: MiUser['noindex'];
|
||||||
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
|
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
|
||||||
const meta = await this.metaService.fetch();
|
const meta = await this.metaService.fetch();
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register to search database
|
// Register to search database
|
||||||
if (user.isIndexable) this.index(note);
|
if (!user.noindex) this.index(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -224,7 +224,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
username: MiUser['username'];
|
username: MiUser['username'];
|
||||||
host: MiUser['host'];
|
host: MiUser['host'];
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isIndexable: MiUser['isIndexable'];
|
noindex: MiUser['noindex'];
|
||||||
}, editid: MiNote['id'], data: Option, silent = false): Promise<MiNote> {
|
}, editid: MiNote['id'], data: Option, silent = false): Promise<MiNote> {
|
||||||
if (!editid) {
|
if (!editid) {
|
||||||
throw new Error('fail');
|
throw new Error('fail');
|
||||||
|
@ -499,7 +499,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
username: MiUser['username'];
|
username: MiUser['username'];
|
||||||
host: MiUser['host'];
|
host: MiUser['host'];
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isIndexable: MiUser['isIndexable'];
|
noindex: MiUser['noindex'];
|
||||||
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
|
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
|
||||||
// Register host
|
// Register host
|
||||||
if (this.userEntityService.isRemoteUser(user)) {
|
if (this.userEntityService.isRemoteUser(user)) {
|
||||||
|
@ -688,7 +688,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register to search database
|
// Register to search database
|
||||||
if (user.isIndexable) this.index(note);
|
if (!user.noindex) this.index(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
@ -525,7 +525,7 @@ export class ApRendererService {
|
||||||
discoverable: user.isExplorable,
|
discoverable: user.isExplorable,
|
||||||
publicKey: this.renderKey(user, keypair, '#main-key'),
|
publicKey: this.renderKey(user, keypair, '#main-key'),
|
||||||
isCat: user.isCat,
|
isCat: user.isCat,
|
||||||
noindex: user.isIndexable,
|
noindex: user.noindex,
|
||||||
speakAsCat: user.speakAsCat,
|
speakAsCat: user.speakAsCat,
|
||||||
attachment: attachment.length ? attachment : undefined,
|
attachment: attachment.length ? attachment : undefined,
|
||||||
};
|
};
|
||||||
|
|
|
@ -310,7 +310,7 @@ export class ApPersonService implements OnModuleInit {
|
||||||
backgroundId: null,
|
backgroundId: null,
|
||||||
lastFetchedAt: new Date(),
|
lastFetchedAt: new Date(),
|
||||||
name: truncate(person.name, nameLength),
|
name: truncate(person.name, nameLength),
|
||||||
isIndexable: (person as any).noindex ?? true,
|
noindex: (person as any).noindex ?? false,
|
||||||
isLocked: person.manuallyApprovesFollowers,
|
isLocked: person.manuallyApprovesFollowers,
|
||||||
movedToUri: person.movedTo,
|
movedToUri: person.movedTo,
|
||||||
movedAt: person.movedTo ? new Date() : null,
|
movedAt: person.movedTo ? new Date() : null,
|
||||||
|
@ -477,7 +477,7 @@ export class ApPersonService implements OnModuleInit {
|
||||||
isBot: getApType(object) === 'Service' || getApType(object) === 'Application',
|
isBot: getApType(object) === 'Service' || getApType(object) === 'Application',
|
||||||
isCat: (person as any).isCat === true,
|
isCat: (person as any).isCat === true,
|
||||||
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
|
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
|
||||||
isIndexable: (person as any).noindex ?? true,
|
noindex: (person as any).noindex ?? false,
|
||||||
isLocked: person.manuallyApprovesFollowers,
|
isLocked: person.manuallyApprovesFollowers,
|
||||||
movedToUri: person.movedTo ?? null,
|
movedToUri: person.movedTo ?? null,
|
||||||
alsoKnownAs: person.alsoKnownAs ?? null,
|
alsoKnownAs: person.alsoKnownAs ?? null,
|
||||||
|
|
|
@ -184,7 +184,7 @@ export interface IActor extends IObject {
|
||||||
};
|
};
|
||||||
'vcard:bday'?: string;
|
'vcard:bday'?: string;
|
||||||
'vcard:Address'?: string;
|
'vcard:Address'?: string;
|
||||||
isIndexable?: boolean;
|
noindex?: boolean;
|
||||||
listenbrainz?: string;
|
listenbrainz?: string;
|
||||||
backgroundUrl?: string;
|
backgroundUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
}))) : [],
|
}))) : [],
|
||||||
isBot: user.isBot,
|
isBot: user.isBot,
|
||||||
isCat: user.isCat,
|
isCat: user.isCat,
|
||||||
isIndexable: user.isIndexable,
|
noindex: user.noindex,
|
||||||
isSilenced: user.isSilenced || this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote),
|
isSilenced: user.isSilenced || this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote),
|
||||||
speakAsCat: user.speakAsCat ?? false,
|
speakAsCat: user.speakAsCat ?? false,
|
||||||
approved: user.approved,
|
approved: user.approved,
|
||||||
|
|
|
@ -189,10 +189,10 @@ export class MiUser {
|
||||||
public isSilenced: boolean;
|
public isSilenced: boolean;
|
||||||
|
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: true,
|
default: false,
|
||||||
comment: 'Whether the User\'s notes get indexed.',
|
comment: 'Whether the User\'s notes dont get indexed.',
|
||||||
})
|
})
|
||||||
public isIndexable: boolean;
|
public noindex: boolean;
|
||||||
|
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: false,
|
default: false,
|
||||||
|
|
|
@ -79,7 +79,7 @@ export const packedUserLiteSchema = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
nullable: false, optional: false,
|
||||||
},
|
},
|
||||||
isIndexable: {
|
noindex: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
nullable: false, optional: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -177,7 +177,7 @@ export const paramDef = {
|
||||||
autoAcceptFollowed: { type: 'boolean' },
|
autoAcceptFollowed: { type: 'boolean' },
|
||||||
noCrawle: { type: 'boolean' },
|
noCrawle: { type: 'boolean' },
|
||||||
preventAiLearning: { type: 'boolean' },
|
preventAiLearning: { type: 'boolean' },
|
||||||
isIndexable: { type: 'boolean' },
|
noindex: { type: 'boolean' },
|
||||||
isBot: { type: 'boolean' },
|
isBot: { type: 'boolean' },
|
||||||
isCat: { type: 'boolean' },
|
isCat: { type: 'boolean' },
|
||||||
speakAsCat: { type: 'boolean' },
|
speakAsCat: { type: 'boolean' },
|
||||||
|
@ -279,7 +279,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
|
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
|
||||||
if (typeof ps.hideOnlineStatus === 'boolean') updates.hideOnlineStatus = ps.hideOnlineStatus;
|
if (typeof ps.hideOnlineStatus === 'boolean') updates.hideOnlineStatus = ps.hideOnlineStatus;
|
||||||
if (typeof ps.publicReactions === 'boolean') profileUpdates.publicReactions = ps.publicReactions;
|
if (typeof ps.publicReactions === 'boolean') profileUpdates.publicReactions = ps.publicReactions;
|
||||||
if (typeof ps.isIndexable === 'boolean') updates.isIndexable = ps.isIndexable;
|
if (typeof ps.noindex === 'boolean') updates.noindex = ps.noindex;
|
||||||
if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot;
|
if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot;
|
||||||
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
|
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
|
||||||
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
|
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
|
||||||
|
|
|
@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
{{ i18n.ts.noCrawle }}
|
{{ i18n.ts.noCrawle }}
|
||||||
<template #caption>{{ i18n.ts.noCrawleDescription }}</template>
|
<template #caption>{{ i18n.ts.noCrawleDescription }}</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
<MkSwitch v-model="isIndexable" @update:modelValue="save()">
|
<MkSwitch v-model="noindex" @update:modelValue="save()">
|
||||||
{{ i18n.ts.makeIndexable }}
|
{{ i18n.ts.makeIndexable }}
|
||||||
<template #caption>{{ i18n.ts.makeIndexableDescription }}</template>
|
<template #caption>{{ i18n.ts.makeIndexableDescription }}</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
|
@ -81,7 +81,7 @@ let isLocked = $ref($i.isLocked);
|
||||||
let autoAcceptFollowed = $ref($i.autoAcceptFollowed);
|
let autoAcceptFollowed = $ref($i.autoAcceptFollowed);
|
||||||
let noCrawle = $ref($i.noCrawle);
|
let noCrawle = $ref($i.noCrawle);
|
||||||
let isExplorable = $ref($i.isExplorable);
|
let isExplorable = $ref($i.isExplorable);
|
||||||
let isIndexable = $ref($i.isIndexable);
|
let noindex = $ref($i.noindex);
|
||||||
let hideOnlineStatus = $ref($i.hideOnlineStatus);
|
let hideOnlineStatus = $ref($i.hideOnlineStatus);
|
||||||
let publicReactions = $ref($i.publicReactions);
|
let publicReactions = $ref($i.publicReactions);
|
||||||
let ffVisibility = $ref($i.ffVisibility);
|
let ffVisibility = $ref($i.ffVisibility);
|
||||||
|
@ -97,7 +97,7 @@ function save() {
|
||||||
autoAcceptFollowed: !!autoAcceptFollowed,
|
autoAcceptFollowed: !!autoAcceptFollowed,
|
||||||
noCrawle: !!noCrawle,
|
noCrawle: !!noCrawle,
|
||||||
isExplorable: !!isExplorable,
|
isExplorable: !!isExplorable,
|
||||||
isIndexable: !!isIndexable,
|
noindex: !!noindex,
|
||||||
hideOnlineStatus: !!hideOnlineStatus,
|
hideOnlineStatus: !!hideOnlineStatus,
|
||||||
publicReactions: !!publicReactions,
|
publicReactions: !!publicReactions,
|
||||||
ffVisibility: ffVisibility,
|
ffVisibility: ffVisibility,
|
||||||
|
|
|
@ -37,7 +37,7 @@ export type UserLite = {
|
||||||
};
|
};
|
||||||
isCat?: boolean;
|
isCat?: boolean;
|
||||||
isBot?: boolean;
|
isBot?: boolean;
|
||||||
isIndexable?: boolean;
|
noindex?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UserDetailed = UserLite & {
|
export type UserDetailed = UserLite & {
|
||||||
|
@ -66,7 +66,7 @@ export type UserDetailed = UserLite & {
|
||||||
speakAsCat: boolean;
|
speakAsCat: boolean;
|
||||||
isFollowed: boolean;
|
isFollowed: boolean;
|
||||||
isFollowing: boolean;
|
isFollowing: boolean;
|
||||||
isIndexable: boolean;
|
noindex: boolean;
|
||||||
isLocked: boolean;
|
isLocked: boolean;
|
||||||
isModerator: boolean;
|
isModerator: boolean;
|
||||||
isMuted: boolean;
|
isMuted: boolean;
|
||||||
|
|
Loading…
Reference in a new issue