Skip to content
Snippets Groups Projects
Commit 361f0b0c authored by Gabriel Engel's avatar Gabriel Engel
Browse files

filter out typing messages

parent 6c174d8e
No related branches found
No related tags found
No related merge requests found
...@@ -26,11 +26,11 @@ Template.chatWindowDashboard.helpers ...@@ -26,11 +26,11 @@ Template.chatWindowDashboard.helpers
console.log 'chatWindowDashboard.helpers messages' if window.rocketDebug console.log 'chatWindowDashboard.helpers messages' if window.rocketDebug
window.lastMessageWindow[this._id] = undefined window.lastMessageWindow[this._id] = undefined
window.lastMessageWindowHistory[this._id] = undefined window.lastMessageWindowHistory[this._id] = undefined
return ChatMessage.find { rid: this._id }, { sort: { ts: 1 } } return ChatMessage.find { rid: this._id, t: { '$ne': 't' } }, { sort: { ts: 1 } }
messagesHistory: -> messagesHistory: ->
console.log 'chatWindowDashboard.helpers messagesHistory' if window.rocketDebug console.log 'chatWindowDashboard.helpers messagesHistory' if window.rocketDebug
return ChatMessageHistory.find { rid: this._id }, { sort: { ts: 1 } } return ChatMessageHistory.find { rid: this._id, t: { '$ne': 't' } }, { sort: { ts: 1 } }
hasMore: -> hasMore: ->
console.log 'chatWindowDashboard.helpers hasMore' if window.rocketDebug console.log 'chatWindowDashboard.helpers hasMore' if window.rocketDebug
...@@ -58,17 +58,16 @@ Template.chatWindowDashboard.helpers ...@@ -58,17 +58,16 @@ Template.chatWindowDashboard.helpers
usersTyping: -> usersTyping: ->
console.log 'chatWindowDashboard.helpers usersTyping' if window.rocketDebug console.log 'chatWindowDashboard.helpers usersTyping' if window.rocketDebug
messages = ChatMessage.find { rid: this._id }, { sort: { ts: 1 } } messages = ChatMessage.find { rid: this._id, t: 't' }, { sort: { ts: 1 } }
usernames = [] usernames = []
selfTyping = false selfTyping = false
messages.forEach (message) -> messages.forEach (message) ->
if message.t is 't' if message.u._id is Meteor.userId()
if message.u._id is Meteor.userId() selfTyping = true
selfTyping = true else
else username = message.u.username
username = message.u.username if username?
if username? usernames.push username
usernames.push username
if usernames.length is 0 if usernames.length is 0
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment