stream_data: Modify is_user_subscribed to use stream id.

This commit changes stream_data.is_user_subscribed to use stream id
instead of stream name.
We are using stream ids so that we can avoid bugs related to live
update after stream rename.
This commit is contained in:
sahil839
2020-07-09 01:58:35 +05:30
committed by Tim Abbott
parent 525b42cecc
commit a0d2c7db16
7 changed files with 30 additions and 29 deletions

View File

@@ -683,8 +683,8 @@ exports.remove_subscriber = function (stream_id, user_id) {
return true;
};
exports.is_user_subscribed = function (stream_name, user_id) {
const sub = exports.get_sub(stream_name);
exports.is_user_subscribed = function (stream_id, user_id) {
const sub = exports.get_sub_by_id(stream_id);
if (typeof sub === 'undefined' || !sub.can_access_subscribers) {
// If we don't know about the stream, or we ourselves cannot access subscriber list,
// so we return undefined (treated as falsy if not explicitly handled).