Skip to content
Snippets Groups Projects
Commit 2beff300 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Fix some mistakes and remove all references for ChatRoom

parent eafaabcb
No related branches found
No related tags found
No related merge requests found
......@@ -300,7 +300,7 @@ class IrcClient
console.log '[irc] createDirectRoomWhenNotExist -> '.yellow, 'source:', source, 'target:', target
rid = [source._id, target._id].sort().join('')
now = new Date()
ChatRoom.RocketChat.models.Rooms.upsert
RocketChat.models.Rooms.upsert
_id: rid
,
$set:
......
RocketChat.models.Rooms = new class asd extends RocketChat.models._Base
constructor: ->
# @model = new Meteor.Collection 'rocketchat_room'
@model = @ChatRoom
@model = new Meteor.Collection 'rocketchat_room'
@tryEnsureIndex { 'name': 1 }, { unique: 1, sparse: 1 }
@tryEnsureIndex { 'u._id': 1 }
......
......@@ -49,7 +49,7 @@ RocketChat.statistics.get = ->
v.avg = v.sum / v.count
return v
result = ChatRoom.mapReduce(m, r, { finalize: f, out: "rocketchat_mr_statistics" })
result = RocketChat.models.Rooms.model.mapReduce(m, r, { finalize: f, out: "rocketchat_mr_statistics" })
statistics.maxRoomUsers = 0
statistics.avgChannelUsers = 0
......
@ChatMessage = new Meteor.Collection 'rocketchat_message'
@ChatRoom = new Meteor.Collection 'rocketchat_room'
@MapReducedStatistics = new Mongo.Collection 'rocketchat_mr_statistics'
@ChatReports = new Meteor.Collection 'rocketchat_reports'
......@@ -20,7 +20,7 @@ Meteor.methods
now = new Date()
# Make sure we have a room
ChatRoom.RocketChat.models.Rooms.upsert
RocketChat.models.Rooms.upsert
_id: rid
,
$set:
......
......@@ -25,7 +25,7 @@ Meteor.methods
rooms = RocketChat.models.Rooms.findByUserId(userId).fetch()
ChatRoom.RocketChat.models.Rooms.removeByTypeContainingUsername 'd', user.username # Remove direct rooms with the user
RocketChat.models.Rooms.removeByTypeContainingUsername 'd', user.username # Remove direct rooms with the user
RocketChat.models.Rooms.removeUsernameFromAll user.username # Remove user from all other rooms
RocketChat.models.Users.removeById userId # Remove user from users database
......
......@@ -10,7 +10,7 @@ Meteor.startup ->
ChatMessage.update({'rid':room._id},{'$set':{'rid':'GENERAL'}},{'multi':1})
RocketChat.models.Rooms.removeById(room._id)
delete room._id
ChatRoom.RocketChat.models.Rooms.upsert({'_id':'GENERAL'},{$set: room})
RocketChat.models.Rooms.upsert({'_id':'GENERAL'},{$set: room})
console.log 'End'
......@@ -8,7 +8,7 @@ Meteor.startup ->
toMigrate = [
{
source: new Meteor.Collection 'data.ChatRoom'
target: ChatRoom
target: RocketChat.models.Rooms.model
}
{
source: new Meteor.Collection 'data.ChatSubscription'
......
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