From 7cf44b139405d5b4db55b6e90c4d1f66236c677f Mon Sep 17 00:00:00 2001 From: Bill Lovett Date: Thu, 2 May 2019 15:10:00 -0400 Subject: [PATCH] Fix incorrect usage of array.concat It doesn't work in-place. --- server/routes/clear.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/routes/clear.ts b/server/routes/clear.ts index 406c3427..4d39d272 100644 --- a/server/routes/clear.ts +++ b/server/routes/clear.ts @@ -11,10 +11,10 @@ const router = PromiseRouter(); * Messages are specified by their public id or local id. */ router.post('/', async (req: Request, res: Response, next: NextFunction) => { - const messageIds: string[] = []; + let messageIds: string[] = []; if (req.body.hasOwnProperty('publicId')) { - messageIds.push(req.body.publicId); + messageIds = messageIds.concat(req.body.publicId); } if (req.body.hasOwnProperty('localId')) { @@ -23,7 +23,7 @@ router.post('/', async (req: Request, res: Response, next: NextFunction) => { req.user, req.body.localId, ); - messageIds.concat(ids); + messageIds = messageIds.concat(ids); } catch (e) { res.status(500); return next(e);