From fec988bb79ef003204a966b65cb84c12b5a4b975 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 14 Aug 2018 08:16:21 +0900 Subject: [PATCH] Provide isFirstNote flag --- src/services/note/create.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 85a03fdc07..b219d1ca51 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -95,6 +95,8 @@ type Option = { }; export default async (user: IUser, data: Option, silent = false) => new Promise(async (res, rej) => { + const isFirstNote = user.notesCount === 0; + if (data.createdAt == null) data.createdAt = new Date(); if (data.visibility == null) data.visibility = 'public'; if (data.viaMobile == null) data.viaMobile = false; @@ -164,6 +166,10 @@ export default async (user: IUser, data: Option, silent = false) => new Promise< // Pack the note const noteObj = await pack(note); + if (isFirstNote) { + noteObj.isFirstNote = true; + } + const nm = new NotificationManager(user, note); const nmRelatedPromises = [];