user groups: Fix membership checks for unknown user groups.

AFAIK I should this never fail, hence the blueslip.error line.  But it
is failing in practice when rendering user groups after looking them
up by ID, and the error handling should definitely be softer.
This commit is contained in:
Tim Abbott
2019-01-14 15:39:03 -08:00
parent 50ef91bb08
commit 164adcd433
2 changed files with 9 additions and 0 deletions

View File

@@ -61,6 +61,10 @@ exports.get_realm_user_groups = function () {
exports.is_member_of = function (user_group_id, user_id) {
var user_group = user_group_by_id_dict.get(user_group_id);
if (user_group === undefined) {
blueslip.error("Could not find user group with ID " + user_group_id);
return false;
}
return user_group.members.has(user_id);
};