Skip to content

Commit

Permalink
Get rid of initialMetricsEnabled
Browse files Browse the repository at this point in the history
The observer function is already passed the new and old values,
we just didn't use them.
  • Loading branch information
Jonathan Cohen committed Apr 17, 2019
1 parent eb64ab8 commit da7829c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/server_manager/ui_components/outline-server-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ <h3>Share anonymous metrics</h3>
update: function(name, metricsEnabled) {
this.initialName = name;
this.name = name;
this.initialMetricsEnabled = metricsEnabled;
this.metricsEnabled = metricsEnabled;
},
_handleNameInputKeyDown: function(event) {
Expand All @@ -195,15 +194,14 @@ <h3>Share anonymous metrics</h3>
this.fire('ServerRenameRequested', {newName});
}
},
_metricsEnabledChanged: function() {
if (this.metricsEnabled === undefined || this.initialMetricsEnabled === undefined) {
_metricsEnabledChanged: function (newMetricsEnabled, oldMetricsEnabled) {
if (oldMetricsEnabled === undefined || newMetricsEnabled === undefined) {
return;
}
// Fire signal if metrics changed.
if (this.metricsEnabled !== this.initialMetricsEnabled) {
const metricsSignal = this.metricsEnabled ?
'EnableMetricsRequested' : 'DisableMetricsRequested';
this.initialMetricsEnabled = this.metricsEnabled;
if (newMetricsEnabled !== oldMetricsEnabled) {
const metricsSignal = newMetricsEnabled ?
'EnableMetricsRequested' : 'DisableMetricsRequested';
this.fire(metricsSignal);
}
},
Expand Down

0 comments on commit da7829c

Please sign in to comment.