mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 13:53:09 +02:00
parent
488e6feed9
commit
69c3c4e3dc
13 changed files with 52 additions and 4 deletions
|
@ -655,6 +655,8 @@ useSystemFont: "システムのデフォルトのフォントを使う"
|
|||
clips: "クリップ"
|
||||
experimentalFeatures: "実験的機能"
|
||||
developer: "開発者"
|
||||
makeExplorable: "アカウントを見つけやすくする"
|
||||
makeExplorableDescription: "オフにすると、「みつける」にアカウントが載らなくなります。"
|
||||
|
||||
_aboutMisskey:
|
||||
about: "Misskeyはsyuiloによって2014年から開発されている、オープンソースのソフトウェアです。"
|
||||
|
|
18
migration/1607353487793-isExplorable.ts
Normal file
18
migration/1607353487793-isExplorable.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
|
||||
export class isExplorable1607353487793 implements MigrationInterface {
|
||||
name = 'isExplorable1607353487793'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "isExplorable" boolean NOT NULL DEFAULT true`);
|
||||
await queryRunner.query(`COMMENT ON COLUMN "user"."isExplorable" IS 'Whether the User is explorable.'`);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_d5a1b83c7cab66f167e6888188" ON "user" ("isExplorable") `);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_d5a1b83c7cab66f167e6888188"`);
|
||||
await queryRunner.query(`COMMENT ON COLUMN "user"."isExplorable" IS 'Whether the User is explorable.'`);
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isExplorable"`);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,6 +9,10 @@
|
|||
{{ $t('noCrawle') }}
|
||||
<template #desc>{{ $t('noCrawleDescription') }}</template>
|
||||
</FormSwitch>
|
||||
<FormSwitch v-model:value="isExplorable" @update:value="save()">
|
||||
{{ $t('makeExplorable') }}
|
||||
<template #desc>{{ $t('makeExplorableDescription') }}</template>
|
||||
</FormSwitch>
|
||||
<FormSwitch v-model:value="rememberNoteVisibility" @update:value="save()">{{ $t('rememberNoteVisibility') }}</FormSwitch>
|
||||
<FormGroup v-if="!rememberNoteVisibility">
|
||||
<template #label>{{ $t('defaultNoteVisibility') }}</template>
|
||||
|
@ -51,6 +55,7 @@ export default defineComponent({
|
|||
isLocked: false,
|
||||
autoAcceptFollowed: false,
|
||||
noCrawle: false,
|
||||
isExplorable: false,
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -75,6 +80,7 @@ export default defineComponent({
|
|||
this.isLocked = this.$store.state.i.isLocked;
|
||||
this.autoAcceptFollowed = this.$store.state.i.autoAcceptFollowed;
|
||||
this.noCrawle = this.$store.state.i.noCrawle;
|
||||
this.isExplorable = this.$store.state.i.isExplorable;
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
@ -87,6 +93,7 @@ export default defineComponent({
|
|||
isLocked: !!this.isLocked,
|
||||
autoAcceptFollowed: !!this.autoAcceptFollowed,
|
||||
noCrawle: !!this.noCrawle,
|
||||
isExplorable: !!this.isExplorable,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,6 +157,13 @@ export class User {
|
|||
})
|
||||
public isModerator: boolean;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
default: true,
|
||||
comment: 'Whether the User is explorable.'
|
||||
})
|
||||
public isExplorable: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}'
|
||||
})
|
||||
|
|
|
@ -240,6 +240,7 @@ export class UserRepository extends Repository<User> {
|
|||
carefulBot: profile!.carefulBot,
|
||||
autoAcceptFollowed: profile!.autoAcceptFollowed,
|
||||
noCrawle: profile!.noCrawle,
|
||||
isExplorable: user.isExplorable,
|
||||
hasUnreadSpecifiedNotes: NoteUnreads.count({
|
||||
where: { userId: user.id, isSpecified: true },
|
||||
take: 1
|
||||
|
|
|
@ -153,6 +153,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
|||
lastFetchedAt: new Date(),
|
||||
name: person.name,
|
||||
isLocked: !!person.manuallyApprovesFollowers,
|
||||
isExplorable: !!person.discoverable,
|
||||
username: person.preferredUsername,
|
||||
usernameLower: person.preferredUsername!.toLowerCase(),
|
||||
host,
|
||||
|
@ -336,6 +337,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
isBot: object.type === 'Service',
|
||||
isCat: (person as any).isCat === true,
|
||||
isLocked: !!person.manuallyApprovesFollowers,
|
||||
isExplorable: !!person.discoverable,
|
||||
} as Partial<User>;
|
||||
|
||||
if (avatar) {
|
||||
|
|
|
@ -38,6 +38,7 @@ export const attachLdSignature = async (activity: any, user: ILocalUser): Promis
|
|||
toot: 'http://joinmastodon.org/ns#',
|
||||
Emoji: 'toot:Emoji',
|
||||
featured: 'toot:featured',
|
||||
discoverable: 'toot:discoverable',
|
||||
// schema
|
||||
schema: 'http://schema.org#',
|
||||
PropertyValue: 'schema:PropertyValue',
|
||||
|
|
|
@ -70,6 +70,7 @@ export async function renderPerson(user: ILocalUser) {
|
|||
image: banner ? renderImage(banner) : null,
|
||||
tag,
|
||||
manuallyApprovesFollowers: user.isLocked,
|
||||
discoverable: !!user.isExplorable,
|
||||
publicKey: renderKey(user, keypair, `#main-key`),
|
||||
isCat: user.isCat,
|
||||
attachment: attachment.length ? attachment : undefined
|
||||
|
|
|
@ -135,6 +135,7 @@ export interface IPerson extends IObject {
|
|||
name?: string;
|
||||
preferredUsername?: string;
|
||||
manuallyApprovesFollowers?: boolean;
|
||||
discoverable?: boolean;
|
||||
inbox?: string;
|
||||
sharedInbox?: string; // 後方互換性のため
|
||||
publicKey: {
|
||||
|
|
|
@ -92,6 +92,10 @@ export const meta = {
|
|||
}
|
||||
},
|
||||
|
||||
isExplorable: {
|
||||
validator: $.optional.bool,
|
||||
},
|
||||
|
||||
carefulBot: {
|
||||
validator: $.optional.bool,
|
||||
desc: {
|
||||
|
@ -208,6 +212,7 @@ export default define(meta, async (ps, user, token) => {
|
|||
}
|
||||
if (ps.mutingNotificationTypes !== undefined) profileUpdates.mutingNotificationTypes = ps.mutingNotificationTypes as typeof notificationTypes[number][];
|
||||
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;
|
||||
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;
|
||||
if (typeof ps.isBot === 'boolean') updates.isBot = ps.isBot;
|
||||
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
|
||||
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
|
||||
|
|
|
@ -64,12 +64,13 @@ export const meta = {
|
|||
|
||||
export default define(meta, async (ps, me) => {
|
||||
const query = Users.createQueryBuilder('user');
|
||||
query.where('user.isExplorable = TRUE');
|
||||
|
||||
switch (ps.state) {
|
||||
case 'admin': query.where('user.isAdmin = TRUE'); break;
|
||||
case 'moderator': query.where('user.isModerator = TRUE'); break;
|
||||
case 'adminOrModerator': query.where('user.isAdmin = TRUE OR isModerator = TRUE'); break;
|
||||
case 'alive': query.where('user.updatedAt > :date', { date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 5) }); break;
|
||||
case 'admin': query.andWhere('user.isAdmin = TRUE'); break;
|
||||
case 'moderator': query.andWhere('user.isModerator = TRUE'); break;
|
||||
case 'adminOrModerator': query.andWhere('user.isAdmin = TRUE OR isModerator = TRUE'); break;
|
||||
case 'alive': query.andWhere('user.updatedAt > :date', { date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 5) }); break;
|
||||
}
|
||||
|
||||
switch (ps.origin) {
|
||||
|
|
|
@ -42,6 +42,7 @@ export const meta = {
|
|||
export default define(meta, async (ps, me) => {
|
||||
const query = Users.createQueryBuilder('user')
|
||||
.where('user.isLocked = FALSE')
|
||||
.andWhere('user.isExplorable = TRUE')
|
||||
.andWhere('user.host IS NULL')
|
||||
.andWhere('user.updatedAt >= :date', { date: new Date(Date.now() - ms('7days')) })
|
||||
.andWhere('user.id != :meId', { meId: me.id })
|
||||
|
|
|
@ -34,6 +34,7 @@ export async function createSystemUser(username: string) {
|
|||
token: secret,
|
||||
isAdmin: false,
|
||||
isLocked: true,
|
||||
isExplorable: false,
|
||||
isBot: true,
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in a new issue