             result[update.node] = []
         result[update.node].push update
     result
+
+generateSubscriptionsNotifications = (updates) ->
+    itemIdsSeen = {}
+    updates.filter((update) ->
+        update.type is 'subscription' or
+        update.type is 'affiliation'
+    ).map((update) ->
+        followee = update.node.match(NODE_OWNER_TYPE_REGEXP)?[1]
+        return
+            type: 'items'
+            node: "/user/#{update.user}/subscriptions"
+            items: [{ id: update.followee }]
+        # Actual item payload will be completed by Notify transaction
+    ).filter((update) ->
+        itemId = update.items[0].id
+        if itemIdsSeen[itemId]?
+            no
+        else
+            itemIdsSeen[itemId] = yes
+            yes
+    )

# and authorization form query
#
# The RSM handling here respects only a <max/> value.
class ReplayArchive extends ModelOperation
    transaction: (t, cb) ->
        max = @req.rsm?.max or 50

                   listeners.indexOf(update.user) < 0
                    listeners.push update.user

            async.forEach listeners, (listener, cb3) =>
                notification = Object.create(@req)
                notification.listener = listener
                @router.notify notification
                cb3()
            , cb2
        ], cb

class ModeratorNotify extends ModelOperation
    transaction: (t, cb) ->
