add localonly
Signed-off-by: mattyatea <mattyacocacora0@gmail.com>
This commit is contained in:
parent
b6692a47ee
commit
c0961eeb23
|
@ -3,11 +3,11 @@ export class Avatardecoration31698323592283 {
|
|||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "avatar_decoration" ADD "host" character varying(128)`);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_3f8079d448095b8d867d318d12" ON "avatar_decoration" ("host") `);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_3f8079d448095b8d867d318d12" ON "avatar_decoration" ("host") `);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`DROP INDEX "public"."IDX_3f8079d448095b8d867d318d12"`);
|
||||
await queryRunner.query(`ALTER TABLE "avatar_decoration" DROP COLUMN "host"`);
|
||||
await queryRunner.query(`ALTER TABLE "avatar_decoration" DROP COLUMN "host"`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
export class AvatardecorationFederation1700197304572 {
|
||||
name = 'AvatardecorationFederation1700197304572'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "avatar_decoration" ADD "localOnly" boolean NOT NULL DEFAULT false`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "avatar_decoration" DROP COLUMN "localOnly"`);
|
||||
}
|
||||
}
|
|
@ -189,7 +189,8 @@ export class ApRendererService {
|
|||
};
|
||||
}
|
||||
@bindThis
|
||||
public renderAvatarDecoration(avatarDecoration: MiAvatarDecoration): IApAvatarDecoration {
|
||||
public renderAvatarDecoration(avatarDecoration: MiAvatarDecoration): IApAvatarDecoration | null {
|
||||
if (avatarDecoration.localOnly) return null;
|
||||
return {
|
||||
id: avatarDecoration.url,
|
||||
type: 'AvatarDecoration',
|
||||
|
|
|
@ -35,6 +35,11 @@ export class MiAvatarDecoration {
|
|||
})
|
||||
public description: string;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public localOnly: boolean;
|
||||
|
||||
// TODO: 定期ジョブで存在しなくなったロールIDを除去するようにする
|
||||
@Column('varchar', {
|
||||
array: true, length: 128, default: '{}',
|
||||
|
|
|
@ -19,6 +19,7 @@ export const paramDef = {
|
|||
properties: {
|
||||
name: { type: 'string', minLength: 1 },
|
||||
description: { type: 'string' },
|
||||
localOnly: { type: 'boolean' },
|
||||
url: { type: 'string', minLength: 1 },
|
||||
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
||||
type: 'string',
|
||||
|
@ -37,6 +38,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
name: ps.name,
|
||||
description: ps.description,
|
||||
url: ps.url,
|
||||
localOnly: ps.localOnly,
|
||||
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
||||
}, me);
|
||||
});
|
||||
|
|
|
@ -45,6 +45,10 @@ export const meta = {
|
|||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
localOnly: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
|
@ -91,6 +95,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
createdAt: this.idService.parse(avatarDecoration.id).date.toISOString(),
|
||||
updatedAt: avatarDecoration.updatedAt?.toISOString() ?? null,
|
||||
name: avatarDecoration.name,
|
||||
localOnly: avatarDecoration.localOnly,
|
||||
description: avatarDecoration.description,
|
||||
url: avatarDecoration.url,
|
||||
roleIdsThatCanBeUsedThisDecoration: avatarDecoration.roleIdsThatCanBeUsedThisDecoration,
|
||||
|
|
|
@ -25,6 +25,7 @@ export const paramDef = {
|
|||
id: { type: 'string', format: 'misskey:id' },
|
||||
name: { type: 'string', minLength: 1 },
|
||||
description: { type: 'string' },
|
||||
localOnly: { type: 'boolean' },
|
||||
url: { type: 'string', minLength: 1 },
|
||||
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
||||
type: 'string',
|
||||
|
@ -43,6 +44,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
name: ps.name,
|
||||
description: ps.description,
|
||||
url: ps.url,
|
||||
localOnly: ps.localOnly,
|
||||
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
||||
}, me);
|
||||
});
|
||||
|
|
|
@ -22,6 +22,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkInput v-model="avatarDecoration.url">
|
||||
<template #label>{{ i18n.ts.imageUrl }}</template>
|
||||
</MkInput>
|
||||
<MkSwitch v-model="avatarDecoration.localOnly">
|
||||
<template #label>{{ i18n.ts.localOnly }}</template>
|
||||
</MkSwitch>
|
||||
<div class="buttons _buttons">
|
||||
<MkButton class="button" inline primary @click="save(avatarDecoration)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
||||
<MkButton v-if="avatarDecoration.id != null" class="button" inline danger @click="del(avatarDecoration)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||
|
@ -56,6 +59,7 @@ import MkFolder from '@/components/MkFolder.vue';
|
|||
let avatarDecorations: any[] = $ref([]);
|
||||
let tab = $ref('avatarDecorations');
|
||||
let acceptHosts: string = $ref('');
|
||||
|
||||
function add() {
|
||||
avatarDecorations.unshift({
|
||||
_id: Math.random().toString(36),
|
||||
|
|
Loading…
Reference in New Issue