Skip to content

Commit

Permalink
- Update isSubv3 to only use isSub when tags aren't available.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandenB committed Dec 24, 2020
1 parent 0dff948 commit 1078029
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions javascript-source/core/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
* @returns {boolean}
*/
function isSub(username) {
return subUsers.contains(username.toLowerCase());
return subUsers.contains(java.util.Objects.toString(username.toLowerCase()));
}

/**
Expand All @@ -249,7 +249,20 @@
* @returns {boolean}
*/
function isSubv3(username, tags) {
return (tags != null && tags != '{}' && tags.get('subscriber').equals('1')) || isSub(username);
if (tags != null && tags != '{}') {
if (tags.containsKey('subscriber')) {
return tags.get('subscriber').equals('1');
} else {
$.consoleDebug('Used isSub without tags::' + tags);
return isSub(username);
}
} else {
$.consoleDebug('Used isSub without tags::' + tags);
return isSub(username);
}

// Only use isSub is we don't have tags, using that method is our last resource.
// return (tags != null && tags != '{}' && tags.get('subscriber').equals('1')) || isSub(username);
}

/**
Expand Down

0 comments on commit 1078029

Please sign in to comment.