kopia lustrzana https://github.com/c9/core
Fixes tracking for unauthorized users client-side
rodzic
a7740a96dd
commit
a1179a9279
|
@ -10,16 +10,21 @@ define(function(require, exports, module) {
|
|||
var hasInternalDomain = require("c9/has-internal-domain");
|
||||
var hasInternalTestName = require("c9/has-internal-test-name");
|
||||
|
||||
function skipAnalytics(user) {
|
||||
function skipAnalytics(user, allowUnauthorized) {
|
||||
if (!user) return true;
|
||||
if (user.id === -1) return true;
|
||||
|
||||
if (!user.id && user.uid === -1) return true;
|
||||
if (!allowUnauthorized && hasUnauthorizedId(user)) return true;
|
||||
|
||||
if (hasInternalTestName(user)) return true;
|
||||
if (hasInternalDomain(user.email)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasUnauthorizedId(user) {
|
||||
if (user.id === -1) return true;
|
||||
|
||||
if (!user.id && user.uid === -1) return true;
|
||||
}
|
||||
|
||||
module.exports = skipAnalytics;
|
||||
});
|
Ładowanie…
Reference in New Issue