c9-core/node_modules/c9/skip-analytics.js

30 wiersze
869 B
JavaScript
Czysty Zwykły widok Historia

2015-10-23 11:46:43 +00:00
if (define === undefined) {
var define = function(fn) {
fn(require, exports, module);
};
}
define(function(require, exports, module) {
"use strict";
2015-12-08 11:56:38 +00:00
2015-10-23 11:46:43 +00:00
var hasInternalDomain = require("c9/has-internal-domain");
2015-11-23 18:35:15 +00:00
var hasInternalTestName = require("c9/has-internal-test-name");
2015-10-23 11:46:43 +00:00
2016-01-25 10:24:23 +00:00
function skipAnalytics(userId, name, email, allowUnauthorized) {
if (typeof userId == "object" && !name) {
var user = userId;
return skipAnalytics(user.id, user.name || user.username, user.email); // make it backwards for the client
}
2016-01-22 15:59:35 +00:00
if (!allowUnauthorized && userId === -1) return true;
2016-01-25 10:24:23 +00:00
if (!userId) return true;
2015-11-23 18:35:15 +00:00
2016-01-25 10:24:23 +00:00
if (hasInternalTestName(name)) return true;
if (hasInternalDomain(email)) return true;
2015-10-23 11:46:43 +00:00
return false;
}
module.exports = skipAnalytics;
});