app/channels/cubism/presence_channel.rb~ in cubism-0.1.0.pre5 vs app/channels/cubism/presence_channel.rb~ in cubism-0.1.0.pre6
- old
+ new
@@ -2,19 +2,30 @@
include CableReady::StreamIdentifier
def subscribed
if resource.present?
stream_for resource
- resource.present_users.add(user.id)
+ resource.cubicle_element_ids << element_id
+ resource.excluded_user_id_for_element_id[element_id] = user.id if exclude_current_user?
else
reject
end
end
def unsubscribed
return unless resource.present?
+ resource.cubicle_element_ids.remove(element_id)
+ resource.excluded_user_id_for_element_id.delete(element_id)
+ disappear
+ end
+
+ def appear
+ resource.present_users.add(user.id)
+ end
+
+ def disappear
resource.present_users.remove(user.id)
end
private
@@ -23,7 +34,19 @@
GlobalID::Locator.locate(locator)
end
def user
GlobalID::Locator.locate_signed(params[:user])
+ end
+
+ def exclude_current_user?
+ params[:exclude_current_user]
+ end
+
+ def element_id
+ params[:element_id]
+ end
+
+ def url
+ params[:url]
end
end