Browse Source

Send out message to thread page each time new post is added

sbkwgh 8 years ago
parent
commit
0f03f106c9
1 changed files with 5 additions and 0 deletions
  1. 5 0
      routes/post.js

+ 5 - 0
routes/post.js

@@ -149,6 +149,11 @@ router.post('/', async (req, res) => {
 		res.json(await post.reload({
 			include: Post.includeOptions()
 		}))
+
+		req.app.get('io').to('thread/' + thread.id).emit('new post', {
+			postNumber: thread.postsCount,
+			id: post.id
+		})
 	} catch (e) {
 		if(e === Errors.VALIDATION_ERROR) {
 			res.status(400)