fix(backend): Play作成時Visibilityの設定が効かない問題を修正 (MisskeyIO#270)

This commit is contained in:
まっちゃとーにゅ 2023-12-01 20:46:24 +09:00 committed by GitHub
parent 41cd11bbf7
commit 61f3854c52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 0 deletions

View File

@ -39,6 +39,7 @@ export const paramDef = {
permissions: { type: 'array', items: { permissions: { type: 'array', items: {
type: 'string', type: 'string',
} }, } },
visibility: { type: 'string', enum: ['public', 'private'] },
}, },
required: ['title', 'summary', 'script', 'permissions'], required: ['title', 'summary', 'script', 'permissions'],
} as const; } as const;
@ -61,6 +62,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
summary: ps.summary, summary: ps.summary,
script: ps.script, script: ps.script,
permissions: ps.permissions, permissions: ps.permissions,
visibility: ps.visibility,
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0])); }).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));
return await this.flashEntityService.pack(flash, me); return await this.flashEntityService.pack(flash, me);

View File

@ -42,6 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const query = this.flashsRepository.createQueryBuilder('flash') const query = this.flashsRepository.createQueryBuilder('flash')
.andWhere('flash.likedCount > 0') .andWhere('flash.likedCount > 0')
.andWhere('flash.visibility = \'public\'')
.orderBy('flash.likedCount', 'DESC'); .orderBy('flash.likedCount', 'DESC');
const flashs = await query.limit(10).getMany(); const flashs = await query.limit(10).getMany();

View File

@ -417,6 +417,7 @@ async function save() {
summary, summary,
permissions, permissions,
script, script,
visibility,
}); });
router.push('/play/' + created.id + '/edit'); router.push('/play/' + created.id + '/edit');
} }