mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
stream_data.js: Replace user_email with user_id in func is_user_subscribed.
This commit is contained in:
@@ -365,18 +365,17 @@ exports.remove_subscriber = function (stream_name, user_id) {
|
||||
return true;
|
||||
};
|
||||
|
||||
exports.user_is_subscribed = function (stream_name, user_email) {
|
||||
exports.is_user_subscribed = function (stream_name, user_id) {
|
||||
var sub = exports.get_sub(stream_name);
|
||||
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).
|
||||
blueslip.warn("We got a user_is_subscribed call for a non-existent or inaccessible stream.");
|
||||
blueslip.warn("We got a is_user_subscribed call for a non-existent or inaccessible stream.");
|
||||
return;
|
||||
}
|
||||
var user_id = people.get_user_id(user_email);
|
||||
if (!user_id) {
|
||||
blueslip.warn("Bad email passed to user_is_subscribed: " + user_email);
|
||||
return false;
|
||||
if (typeof user_id === "undefined") {
|
||||
blueslip.warn("Undefined user_id passed to function is_user_subscribed");
|
||||
return;
|
||||
}
|
||||
|
||||
return sub.subscribers.has(user_id);
|
||||
|
||||
Reference in New Issue
Block a user