file name restructuring

pull/153/merge
Gabriel Engel 11 years ago
parent ea9689b6a5
commit b89ba68a0f
  1. 10
      client/lib/RoomManager.coffee
  2. 2
      client/routes/router.coffee
  3. 5
      client/views/app/chatMessageDashboard.coffee
  4. 4
      client/views/app/chatWindowDashboard.coffee
  5. 4
      server/publications/activeUsers.coffee
  6. 4
      server/publications/messages.coffee
  7. 4
      server/publications/privateHistoryRooms.coffee
  8. 4
      server/publications/subscription.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

@ -110,4 +110,4 @@ Router.route '/history/private',
this.render 'privateHistory'
waitOn: ->
return [ Meteor.subscribe('privateHistoryRooms') ]
return [ Meteor.subscribe('privateHistory') ]

@ -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, '<br/>'
# TODO Create as very last helper, is braking MD
# msg = msg.replace /\n/g, '<br/>'
if not this.mentions? or this.mentions.length is 0
return msg

@ -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()

@ -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:

@ -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()

@ -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

@ -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
Loading…
Cancel
Save