Skip to content

Commit

Permalink
Added local mizzao:partitioner package and renamed Helper to Partitio…
Browse files Browse the repository at this point in the history
…nHelper
  • Loading branch information
jaypanares committed Jul 7, 2015
1 parent 9386166 commit 2b04cc4
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ rocketchat:autolinker
rocketchat:emojione
rocketchat:file
rocketchat:highlight
rocketchat:hubot
#rocketchat:irc
rocketchat:ldap
rocketchat:lib
Expand All @@ -59,3 +58,4 @@ yasaricli:slugify
konecty:nrr
konecty:change-case
kevohagan:sweetalert
mizzao:partitioner
2 changes: 1 addition & 1 deletion .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ meteorspark:util@0.2.0
minifiers@1.1.5
minimongo@1.0.8
mizzao:autocomplete@0.5.1
mizzao:partitioner@0.5.4
mizzao:timesync@0.3.1
mobile-status-bar@1.0.3
momentjs:moment@2.10.3
Expand Down Expand Up @@ -97,7 +98,6 @@ rocketchat:autolinker@0.0.1
rocketchat:emojione@0.0.1
rocketchat:file@0.0.1
rocketchat:highlight@0.0.1
rocketchat:hubot@0.0.1
rocketchat:ldap@0.0.1
rocketchat:lib@0.0.1
rocketchat:markdown@0.0.1
Expand Down
2 changes: 2 additions & 0 deletions client/jaysCode/onLogin.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Accounts.onLogin () ->
Meteor.call('setDefaultGroup')
11 changes: 6 additions & 5 deletions client/lib/RoomManager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
Dep = new Tracker.Dependency

init = ->
subscription = Meteor.subscribe('subscription')
return subscription
# Tracker.autorun ->
subscription = Meteor.subscribe('subscription')
return subscription

close = (rid) ->
if openedRooms[rid]
Expand All @@ -24,12 +25,12 @@
computation = Tracker.autorun ->
for rid, record of openedRooms when record.active is true
record.sub = [
Meteor.subscribe 'room', rid
Meteor.subscribe 'messages', rid
Meteor.subscribe 'room', rid, Partitioner.group()
Meteor.subscribe 'messages', rid, Partitioner.group()
]

record.ready = record.sub[0].ready() and record.sub[1].ready()

Dep.changed()

setRoomExpireExcept = (except) ->
Expand Down
5 changes: 5 additions & 0 deletions client/lib/collections.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
@UserAndRoom = new Meteor.Collection null
Partitioner.partitionCollection(@UserAndRoom)
@ChatMessageHistory = new Meteor.Collection null
Partitioner.partitionCollection(@ChatMessageHistory)

@ChatRoom = new Meteor.Collection 'data.ChatRoom'
Partitioner.partitionCollection(@ChatRoom)
@ChatSubscription = new Meteor.Collection 'data.ChatSubscription'
Partitioner.partitionCollection(@ChatSubscription)
@ChatMessage = new Meteor.Collection 'data.ChatMessage'
Partitioner.partitionCollection(@ChatMessage)

Meteor.startup ->
ChatMessage.find().observe
Expand Down
1 change: 1 addition & 0 deletions packages/meteor-partitioner
Submodule meteor-partitioner added at c4d932
3 changes: 2 additions & 1 deletion packages/rocketchat-oembed/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Package.onUse(function(api) {
api.use([
'templating',
'coffeescript',
'rocketchat:lib@0.0.1'
'rocketchat:lib@0.0.1',
'mizzao:partitioner'
]);

api.addFiles('client/baseWidget.html', 'client');
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-oembed/server/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ querystring = Npm.require('querystring')
OEmbed =
cache: new Meteor.Collection 'oembed_cache'

Partitioner.partitionCollection(OEmbed.cache)

getUrlContent = (urlObj, redirectCount = 5, callback) ->
if _.isString(urlObj)
urlObj = URL.parse urlObj
Expand Down
1 change: 1 addition & 0 deletions server/lib/_settings.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@Settings = new Meteor.Collection 'settings'
Partitioner.partitionCollection(@Settings)

loadEnvConfigs = (settings) ->
if settings.ENV?
Expand Down
3 changes: 3 additions & 0 deletions server/lib/collections.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@ChatMessage = new Meteor.Collection 'data.ChatMessage'
Partitioner.partitionCollection(@ChatMessage);
@ChatRoom = new Meteor.Collection 'data.ChatRoom'
Partitioner.partitionCollection(@ChatRoom);
@ChatSubscription = new Meteor.Collection 'data.ChatSubscription'
Partitioner.partitionCollection(@ChatSubscription);
5 changes: 5 additions & 0 deletions server/methods/partitionerMethods.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Meteor.methods
setDefaultGroup: ->
console.log this.userId
if not Partitioner.group()?
Partitioner.setUserGroup(this.userId, 'lobby')
1 change: 0 additions & 1 deletion server/startup/initialData.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Meteor.startup ->
Meteor.defer ->


if not ChatRoom.findOne('name': 'general')?
ChatRoom.insert
_id: 'GENERAL'
Expand Down

0 comments on commit 2b04cc4

Please sign in to comment.