Merge pull request #1858 from matrix-org/luke/fix-piwik-crash3
Fix bug that caused crash when analytics HS/IS whitelists not specified
This commit is contained in:
commit
05f1ca6942
2 changed files with 4 additions and 3 deletions
|
@ -190,6 +190,7 @@ class Analytics {
|
||||||
}
|
}
|
||||||
|
|
||||||
_setVisitVariable(key, value) {
|
_setVisitVariable(key, value) {
|
||||||
|
if (this.disabled) return;
|
||||||
this._paq.push(['setCustomVariable', customVariables[key].id, key, value, 'visit']);
|
this._paq.push(['setCustomVariable', customVariables[key].id, key, value, 'visit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +200,8 @@ class Analytics {
|
||||||
const config = SdkConfig.get();
|
const config = SdkConfig.get();
|
||||||
if (!config.piwik) return;
|
if (!config.piwik) return;
|
||||||
|
|
||||||
const whitelistedHSUrls = config.piwik.whitelistedHSUrls;
|
const whitelistedHSUrls = config.piwik.whitelistedHSUrls || [];
|
||||||
const whitelistedISUrls = config.piwik.whitelistedISUrls;
|
const whitelistedISUrls = config.piwik.whitelistedISUrls || [];
|
||||||
|
|
||||||
this._setVisitVariable('User Type', isGuest ? 'Guest' : 'Logged In');
|
this._setVisitVariable('User Type', isGuest ? 'Guest' : 'Logged In');
|
||||||
this._setVisitVariable('Homeserver URL', whitelistRedact(whitelistedHSUrls, homeserverUrl));
|
this._setVisitVariable('Homeserver URL', whitelistRedact(whitelistedHSUrls, homeserverUrl));
|
||||||
|
|
|
@ -352,7 +352,7 @@ export default React.createClass({
|
||||||
defaultDeviceDisplayName: this.props.defaultDeviceDisplayName,
|
defaultDeviceDisplayName: this.props.defaultDeviceDisplayName,
|
||||||
});
|
});
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error(`Error attempting to load session: ${e}`);
|
console.error('Error attempting to load session', e);
|
||||||
return false;
|
return false;
|
||||||
}).then((loadedSession) => {
|
}).then((loadedSession) => {
|
||||||
if (!loadedSession) {
|
if (!loadedSession) {
|
||||||
|
|
Loading…
Reference in a new issue