Prefers public getters over duplication of logic and/or access to private fields at multiple locations.

This commit is contained in:
Lyubomir Marinov 2016-01-13 22:00:30 +02:00
parent d7c9a97e8d
commit 2b570a2251
2 changed files with 7 additions and 4 deletions

View File

@ -79,7 +79,7 @@ var Feedback = {
init: function () { init: function () {
// CallStats is the way we send feedback, so we don't have to initialise // CallStats is the way we send feedback, so we don't have to initialise
// if callstats isn't enabled. // if callstats isn't enabled.
if (!callStats.isEnabled()) if (!this.isEnabled())
return; return;
$("div.feedbackButton").css("display", "block"); $("div.feedbackButton").css("display", "block");
@ -93,6 +93,9 @@ var Feedback = {
* @return true if the feedback functionality is enabled, false otherwise. * @return true if the feedback functionality is enabled, false otherwise.
*/ */
isEnabled: function() { isEnabled: function() {
// XXX callStats.isEnabled() indicates whether we are allowed to attempt
// to integrate callstats.io. Whether our attempt was/is/will be
// successful is a different question.
return callStats.isEnabled(); return callStats.isEnabled();
}, },
/** /**

View File

@ -31,7 +31,7 @@ var callStatsIntegrationEnabled = config.callStatsID && config.callStatsSecret;
var CallStats = { var CallStats = {
init: function (jingleSession) { init: function (jingleSession) {
if(!callStatsIntegrationEnabled || callStats !== null) { if(!this.isEnabled() || callStats !== null) {
return; return;
} }
@ -146,7 +146,7 @@ var CallStats = {
_reportError: function (type, e, pc) { _reportError: function (type, e, pc) {
if (callStats) { if (callStats) {
callStats.reportError(pc, this.confID, type, e); callStats.reportError(pc, this.confID, type, e);
} else if (callStatsIntegrationEnabled) { } else if (this.isEnabled()) {
pendingErrors.push({ pendingErrors.push({
type: type, type: type,
error: e, error: e,