refactor: Change params for subs.mark_subscribed().

We pass in sub instead of stream_name, to support callers that
already do lookups by stream id.

And then we make the second optional argument be subscribers, since
that is all we were using from the old `attrs` argument.
This commit is contained in:
Steve Howell
2017-03-04 15:09:48 -08:00
committed by Tim Abbott
parent 2f8ecad295
commit c5757ac8fe
3 changed files with 19 additions and 12 deletions

View File

@@ -177,8 +177,13 @@ function dispatch_normal_event(event) {
var email;
if (event.op === 'add') {
_.each(event.subscriptions, function (sub) {
subs.mark_subscribed(sub.name, sub);
_.each(event.subscriptions, function (rec) {
var sub = stream_data.get_sub_by_id(rec.stream_id);
if (sub) {
subs.mark_subscribed(sub, rec.subscribers);
} else {
blueslip.error('Subscribing to unknown stream' + rec.stream_id);
}
});
} else if (event.op === 'peer_add') {
// TODO: remove email shim here and fix called functions