diff --git a/client/lib/RoomManager.coffee b/client/lib/RoomManager.coffee index 9ff08ad9ff9..cbbfe6e3b36 100644 --- a/client/lib/RoomManager.coffee +++ b/client/lib/RoomManager.coffee @@ -1,13 +1,13 @@ @RoomManager = new class defaultTime = 600000 # 10 minutes openedRooms = {} - myRoomActivity = null + subscription = null Dep = new Tracker.Dependency init = -> - myRoomActivity = Meteor.subscribe('myRoomActivity') - return myRoomActivity + subscription = Meteor.subscribe('subscription') + return subscription expireRoom = (roomId) -> if openedRooms[roomId] @@ -21,7 +21,7 @@ computation = Tracker.autorun -> for roomId, record of openedRooms when record.active is true record.sub = [ - Meteor.subscribe 'dashboardRoom', roomId, moment().subtract(2, 'hour').startOf('day').toDate() + Meteor.subscribe 'messages', roomId, moment().subtract(2, 'hour').startOf('day').toDate() ] # @TODO talvez avaliar se todas as subscriptions do array estão 'ready', mas por enquanto, as mensagens são o mais importante record.ready = record.sub[0].ready() @@ -50,7 +50,7 @@ active: false ready: false - if myRoomActivity.ready() + if subscription.ready() if ChatSubscription.findOne { rid: roomId, 'u._id': Meteor.userId() }, { reactive: false } openedRooms[roomId].active = true setRoomExpireExcept roomId diff --git a/client/routes/router.coffee b/client/routes/router.coffee index 3a77ba6d802..22dd72fd3b3 100644 --- a/client/routes/router.coffee +++ b/client/routes/router.coffee @@ -110,4 +110,4 @@ Router.route '/history/private', this.render 'privateHistory' waitOn: -> - return [ Meteor.subscribe('privateHistoryRooms') ] + return [ Meteor.subscribe('privateHistory') ] diff --git a/client/views/app/chatMessageDashboard.coffee b/client/views/app/chatMessageDashboard.coffee index e6ba85b9b02..831f54bddfa 100644 --- a/client/views/app/chatMessageDashboard.coffee +++ b/client/views/app/chatMessageDashboard.coffee @@ -14,9 +14,10 @@ Template.chatMessageDashboard.helpers autolinkerAndMentions: -> msg = this.msg - msg = Autolinker.link(_.stripTags(msg), { stripPrefix: false, twitter: false }) + msg = Autolinker.link(_.escapeHTML(msg), { stripPrefix: false, twitter: false }) - msg = msg.replace /\n/g, '
' + # TODO Create as very last helper, is braking MD + # msg = msg.replace /\n/g, '
' if not this.mentions? or this.mentions.length is 0 return msg diff --git a/client/views/app/chatWindowDashboard.coffee b/client/views/app/chatWindowDashboard.coffee index 87d196462ee..fff8cda9b1b 100644 --- a/client/views/app/chatWindowDashboard.coffee +++ b/client/views/app/chatWindowDashboard.coffee @@ -241,7 +241,7 @@ Template.chatWindowDashboard.helpers status = Session.get 'user_' + username + '_status' if status in ['online', 'away', 'busy'] return {username: username, status: status} - return + return roomUsers: -> room = ChatRoom.findOne(this._id, { reactive: false }) @@ -427,7 +427,7 @@ Template.chatWindowDashboard.onCreated -> this.scrollOnBottom = true this.showUsersOffline = new ReactiveVar false - this.subscribe("allUsers") + this.subscribe("activeUsers") Template.chatWindowDashboard.onRendered -> FlexTab.check() diff --git a/server/publications/allUsers.coffee b/server/publications/activeUsers.coffee similarity index 70% rename from server/publications/allUsers.coffee rename to server/publications/activeUsers.coffee index d439374d3f4..13594b4ceb0 100644 --- a/server/publications/allUsers.coffee +++ b/server/publications/activeUsers.coffee @@ -1,8 +1,8 @@ -Meteor.publish 'allUsers', -> +Meteor.publish 'activeUsers', -> unless this.userId return this.ready() - console.log '[publish] allUsers'.green + console.log '[publish] activeUsers'.green Meteor.users.find username: diff --git a/server/publications/dashboardRoom.coffee b/server/publications/messages.coffee similarity index 56% rename from server/publications/dashboardRoom.coffee rename to server/publications/messages.coffee index 66bddc814dc..eb4d601f0d6 100644 --- a/server/publications/dashboardRoom.coffee +++ b/server/publications/messages.coffee @@ -1,8 +1,8 @@ -Meteor.publish 'dashboardRoom', (rid, start) -> +Meteor.publish 'messages', (rid, start) -> unless this.userId return this.ready() - console.log '[publish] dashboardRoom ->'.green, 'rid:', rid, 'start:', start + console.log '[publish] messages ->'.green, 'rid:', rid, 'start:', start if typeof rid isnt 'string' return this.ready() diff --git a/server/publications/privateHistoryRooms.coffee b/server/publications/privateHistoryRooms.coffee index cfd8aadac26..d78f8944fd7 100644 --- a/server/publications/privateHistoryRooms.coffee +++ b/server/publications/privateHistoryRooms.coffee @@ -1,8 +1,8 @@ -Meteor.publish 'privateHistoryRooms', -> +Meteor.publish 'privateHistory', -> unless this.userId return this.ready() - console.log '[publish] privateHistoryRooms'.green + console.log '[publish] privateHistory'.green ChatRoom.find usernames: Meteor.users.findOne(this.userId).username diff --git a/server/publications/myRoomActivity.coffee b/server/publications/subscription.coffee similarity index 84% rename from server/publications/myRoomActivity.coffee rename to server/publications/subscription.coffee index ebd4e1cb831..feca2b360a7 100644 --- a/server/publications/myRoomActivity.coffee +++ b/server/publications/subscription.coffee @@ -1,8 +1,8 @@ -Meteor.publish 'myRoomActivity', -> +Meteor.publish 'subscription', -> unless this.userId return this.ready() - console.log '[publish] myRoomActivity'.green + console.log '[publish] subscription'.green return Meteor.publishWithRelations handle: this