From fc31e44fd2d70ae8f4114009a26f00fc5db01fca Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 15 Sep 2018 05:42:14 +0900 Subject: [PATCH] Fix bug --- src/server/api/endpoints/aggregation/hashtags.ts | 2 +- src/server/api/endpoints/hashtags/trend.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/api/endpoints/aggregation/hashtags.ts b/src/server/api/endpoints/aggregation/hashtags.ts index c5aacd89cd..ffeafb2538 100644 --- a/src/server/api/endpoints/aggregation/hashtags.ts +++ b/src/server/api/endpoints/aggregation/hashtags.ts @@ -3,7 +3,7 @@ import Meta from '../../../../models/meta'; export default () => new Promise(async (res, rej) => { const meta = await Meta.findOne({}); - const hidedTags = (meta.hidedTags || []).map(t => t.toLowerCase()); + const hidedTags = meta ? (meta.hidedTags || []).map(t => t.toLowerCase()) : []; const span = 1000 * 60 * 60 * 24 * 7; // 1週間 diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index bfa475619c..0ec6a4ffec 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -19,7 +19,7 @@ const max = 5; */ export default () => new Promise(async (res, rej) => { const meta = await Meta.findOne({}); - const hidedTags = (meta.hidedTags || []).map(t => t.toLowerCase()); + const hidedTags = meta ? (meta.hidedTags || []).map(t => t.toLowerCase()) : []; //#region 1. 直近Aの内に投稿されたハッシュタグ(とユーザーのペア)を集計 const data = await Note.aggregate([{