asmer@controller 4 years ago
parent
commit
d4e91f41d6
2 changed files with 5 additions and 5 deletions
  1. 4 4
      index.js
  2. 1 1
      package-lock.json

+ 4 - 4
index.js

@@ -161,17 +161,17 @@ const upload  = require('multer')({ dest: uploadPath })
         console.log('NEW MSG', msg.text, msg.chat.title, msg.owner.login)
         for (let [id,{user, socket}] of Object.entries(sockets)){
             if (user.chats.some(chat => chat._id.toString() === msg.chat._id.toString())){
-                const {_id, createdAt, text, chat, media, replyTo, forwarded, owner} = msg
+                let {_id, createdAt, text, chat, media, replyTo, forwarded, owner} = msg
                 await chat;
                 await media;
                 await replyTo;
                 await forwarded;
-                await owner;
+                owner = await owner;
                 socket.emit('msg', {_id, createdAt, text, chat: chat && {_id: chat._id, title: chat.title},
                                                           media: media && {_id: media._id, url: media.url},
                                                           replyTo: replyTo && {_id: replyTo._id, text: replyTo.text},
-                                                          forwarded: forwarded && {_id: forwarded._id, text: forwarded.text,
-                                                          owner: {_id: owner_id, login: owner.login, nick: owner.nick}}})
+                                                          forwarded: forwarded && {_id: forwarded._id, text: forwarded.text},
+                                                          owner: {_id: owner._id, login: owner.login, nick: owner.nick}})
             }
         }
     }

+ 1 - 1
package-lock.json

@@ -640,7 +640,7 @@
         "express-graphql": "^0.9.0",
         "graphql": "^14.4.2",
         "jsonwebtoken": "^8.5.1",
-        "mm": "git+ssh://git@gitlab.a-level.com.ua:gitgod/mm.git#8ae3c69780bf9cb25097a4c0a0a0ad01efc02327"
+        "mm": "git+ssh://git@gitlab.a-level.com.ua:gitgod/mm.git"
       },
       "dependencies": {
         "express-graphql": {