Skip to content

Commit

Permalink
fix(FEC-8349): OTT analytics - no event send for logged user (#134)
Browse files Browse the repository at this point in the history
evaluate false and 0 values
parse string to boolean and number when applicable ("false", "1" etc.)
  • Loading branch information
yairans authored and Dan Ziv committed Jun 25, 2018
1 parent b279725 commit f3e1766
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/common/plugins/plugins-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ function evaluatePluginsConfig(options: KalturaPlayerOptionsObject): void {
const evaluatedConfig = evaluate(JSON.stringify(pluginsConfig), dataModel);
let evaluatedConfigObj;
try {
evaluatedConfigObj = JSON.parse(evaluatedConfig);
evaluatedConfigObj = JSON.parse(evaluatedConfig, function (key) {
try {
return JSON.parse(this[key]);
} catch (e) {
return (this[key]);
}});
} catch (e) {
evaluatedConfigObj = {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/utils/evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function evaluate(template: string, model: Object = {}): string {
let reg, res = template;
for (let key in model) {
reg = new RegExp('{{' + key + '}}', 'g');
res = res.replace(reg, model[key] || "");
res = res.replace(reg, (model[key] !== undefined && model[key] !== null) ? model[key] : "");
}
return res;
} catch (e) {
Expand Down
1 change: 0 additions & 1 deletion test/src/common/utils/ui-wrapper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ describe('UIWrapper', function () {
uiWrapper._uiManager.store.getState().config.components.seekbar = {};
sandbox.restore();
uiWrapper = null;
player.destroy();
player = null;
});

Expand Down

0 comments on commit f3e1766

Please sign in to comment.