mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Return subscription object(s) when updating the collection
This commit is contained in:
parent
7fe67bb67a
commit
1d5f80c758
1 changed files with 4 additions and 3 deletions
|
@ -16,8 +16,6 @@ class ActionCable.Subscriptions
|
|||
subscription = new ActionCable.Subscription @consumer, params, mixin
|
||||
@add(subscription)
|
||||
|
||||
subscription
|
||||
|
||||
# Private
|
||||
|
||||
add: (subscription) ->
|
||||
|
@ -25,20 +23,23 @@ class ActionCable.Subscriptions
|
|||
@consumer.ensureActiveConnection()
|
||||
@notify(subscription, "initialized")
|
||||
@sendCommand(subscription, "subscribe")
|
||||
subscription
|
||||
|
||||
remove: (subscription) ->
|
||||
@forget(subscription)
|
||||
|
||||
unless @findAll(subscription.identifier).length
|
||||
@sendCommand(subscription, "unsubscribe")
|
||||
subscription
|
||||
|
||||
reject: (identifier) ->
|
||||
for subscription in @findAll(identifier)
|
||||
@forget(subscription)
|
||||
@notify(subscription, "rejected")
|
||||
subscription
|
||||
|
||||
forget: (subscription) ->
|
||||
@subscriptions = (s for s in @subscriptions when s isnt subscription)
|
||||
subscription
|
||||
|
||||
findAll: (identifier) ->
|
||||
s for s in @subscriptions when s.identifier is identifier
|
||||
|
|
Loading…
Reference in a new issue