From 31e9077f1efe2e372b7bc479769f4fb5402a4382 Mon Sep 17 00:00:00 2001
From: Moreau Elise <moreau.elise13@gmail.com>
Date: Sat, 19 Jun 2021 16:17:23 +0200
Subject: [PATCH] [room] fix duplicates and remove emit function

---
 api/routes/rooms_routes.js | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/api/routes/rooms_routes.js b/api/routes/rooms_routes.js
index 3503d745d..f7f5dcda3 100644
--- a/api/routes/rooms_routes.js
+++ b/api/routes/rooms_routes.js
@@ -44,7 +44,6 @@ router.post('/', validator.body(roomSchema), async function(req, res, next){
     
     res.json(newRoom);
     
-    emit('new-room', newRoom, newRoom.users);
 });
 
 // Liste des room contenant l'utilisateur courant
@@ -72,7 +71,6 @@ router.get('/:id/messages', async function (req, res, next) {
 
     try {
         room = await Room.findOne({ _id: req.params.id, users: req.user.id });
-        room = await Room.findById(req.params.id);
     } catch (err){
         return next(err);
     }
@@ -85,7 +83,6 @@ router.get('/:id/messages', async function (req, res, next) {
             .populate('author')
             .sort({ date: -1 })
             .limit(50);
-        messages = await Message.find({room: room._id}).sort({ date: -1 }).limit(50);
     } catch(err) {
         return next(err);
     }
-- 
GitLab