From 0b6b6a4f2f48875acdf712f5abc8f7ca88cefecf Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 2 Dec 2018 19:05:08 +0900 Subject: [PATCH 1/4] Remove unneccesary casts --- src/server/web/docs.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index b535a236d..9cc54cdf0 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -30,7 +30,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { const entities = glob.sync('src/docs/api/entities/**/*.yaml', { cwd }); vars['entities'] = entities.map(x => { - const _x = yaml.safeLoad(fs.readFileSync(cwd + x, 'utf-8')) as any; + const _x = yaml.safeLoad(fs.readFileSync(cwd + x, 'utf-8')); return _x.name; }); @@ -197,7 +197,7 @@ router.get('/*/api/entities/*', async ctx => { const lang = ctx.params[0]; const entity = ctx.params[1]; - const x = yaml.safeLoad(fs.readFileSync(path.resolve(`${__dirname}/../../../src/docs/api/entities/${entity}.yaml`), 'utf-8')) as any; + const x = yaml.safeLoad(fs.readFileSync(path.resolve(`${__dirname}/../../../src/docs/api/entities/${entity}.yaml`), 'utf-8')); await ctx.render('../../../../src/docs/api/entities/view', Object.assign(await genVars(lang), { id: `api/entities/${entity}`, From 92701e5cec29a013a3d5ec1d6d0f6d323bc5e3fe Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 2 Dec 2018 19:24:57 +0900 Subject: [PATCH 2/4] Fix #3445 (#3471) --- src/server/api/endpoints/notes.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index f7b7b65ca..b48919707 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -106,9 +106,7 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { const withFiles = ps.withFiles != undefined ? ps.withFiles : ps.media; - if (withFiles) { - query.fileIds = withFiles ? { $exists: true, $ne: null } : []; - } + if (withFiles) query.fileIds = { $exists: true, $ne: null }; if (ps.poll != undefined) { query.poll = ps.poll ? { $exists: true, $ne: null } : null; From a0d9def98aab3d5cd22d0ade061e36619597e2a3 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 2 Dec 2018 19:35:41 +0900 Subject: [PATCH 3/4] Simplify expressions (#3473) --- src/remote/activitypub/models/person.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 74fcdc10a..2bd0eaf25 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -164,7 +164,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise Date: Sun, 2 Dec 2018 20:10:56 +0900 Subject: [PATCH 4/4] Use primitive type boolean (#3474) --- src/models/notification.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/notification.ts b/src/models/notification.ts index 394e49f36..5cf1e140c 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -48,7 +48,7 @@ export interface INotification { /** * 通知が読まれたかどうか */ - isRead: Boolean; + isRead: boolean; } export const packMany = (