Skip to content

Commit

Permalink
Confine disconnect/connect activities to primary channel (Fixes #135).
Browse files Browse the repository at this point in the history
  • Loading branch information
mjtko committed Mar 2, 2013
1 parent 0877f00 commit f3aa968
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/models/channel.rb
Expand Up @@ -15,18 +15,16 @@ def ensure_app_max_rooms
end

class << self
def primary
self.find(1)
end

def user_connect(user)
Channel.all.each do |channel|
activity = channel.activities.build(:user_id => user.id, :action => "connect")
activity.save
end
activity = Channel.primary.activities.create!(:user_id => user.id, :action => "connect")
end

def user_disconnect(user)
Channel.all.each do |channel|
activity = channel.activities.build(:user_id => user.id, :action => "disconnect")
activity.save
end
activity = Channel.primary.activities.create!(:user_id => user.id, :action => "disconnect")
end
end
end

0 comments on commit f3aa968

Please sign in to comment.