From 1857d4ecd901d8a88fb616c793825b7b23ab2237 Mon Sep 17 00:00:00 2001
From: Reid Wakida <rwakida@gmail.com>
Date: Thu, 9 Jul 2015 00:39:47 -1000
Subject: [PATCH] Fix RocketChat/Rocket.Chat#239 room's message count and last
 message timestamp is not updated when a message is sent.

The ChatRoom update selector referenced the wrong (non-existant) field.
Thus, the room's message count was never incremented.  Also fixes issue
where the room's last message timestamp is not set on the room document.
---
 packages/rocketchat-lib/server/sendMessage.coffee | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/rocketchat-lib/server/sendMessage.coffee b/packages/rocketchat-lib/server/sendMessage.coffee
index 540c60df1d1..f0f5e46d6f8 100644
--- a/packages/rocketchat-lib/server/sendMessage.coffee
+++ b/packages/rocketchat-lib/server/sendMessage.coffee
@@ -45,12 +45,12 @@ RocketChat.sendMessage = (user, message, room) ->
 
 		ChatRoom.update
 			# only subscriptions to the same room
-			rid: message.rid
+			_id: message.rid
 		,
 			# update the last message timestamp
 			$set:
 				lm: message.ts
-			# increate the messages counter
+			# increment the messages counter
 			$inc:
 				msgs: 1
 
-- 
GitLab