diff options
author | Simon Fondrie-Teitler <simonft@riseup.net> | 2017-05-15 20:16:36 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-05-19 20:29:57 +0200 |
commit | feb2818a275830372e452dba7228bfd322f49bf8 (patch) | |
tree | 0c9560906542cf558848cdfa06cf78fedbc1668c | |
parent | f5d50c91dae4208e969f83b47f84d1ee602d09b9 (diff) |
[bug] Don't update VPN status component for wrong domain
Previously, if the active VPN was in the connecting state and the VPN
status component for another account was rendered the status for the
new account would show as connecting. This was because it didn't check
the domain returned from the status endpoint when parsing the returned
data and setting "connecting" as the status. We can safely assume that
a non active VPN is in the "down" state, so that's what this commit
does.
-rw-r--r-- | ui/app/components/main_panel/vpn_section.js | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/ui/app/components/main_panel/vpn_section.js b/ui/app/components/main_panel/vpn_section.js index 4430ad96..71bbbe1d 100644 --- a/ui/app/components/main_panel/vpn_section.js +++ b/ui/app/components/main_panel/vpn_section.js @@ -61,22 +61,19 @@ export default class vpnSection extends React.Component { bitmask.vpn.status().then( vpn => { this.stopWatchingStatus() - if (vpn.status == "off") { + // If the current active VPN does not match this domain, ignore the status info. + if (vpn.domain !== domain || vpn.status === "off") { this.setState({vpn: "down"}) - } else if (vpn.status == "on") { - if (vpn.domain == domain) { - this.setState({ - vpn: "up", - up: vpn.up, - down: vpn.down - }) - this.startWatchingStatus() - } else { - this.setState({vpn: "down"}) - } - } else if (vpn.status == "disabled") { + } else if (vpn.status === "on") { + this.setState({ + vpn: "up", + up: vpn.up, + down: vpn.down + }) + this.startWatchingStatus() + } else if (vpn.status === "disabled") { this.setState({vpn: "disabled"}) - } else if (vpn.status == "starting") { + } else if (vpn.status === "starting") { this.setState({vpn: "connecting"}) } else { console.log("UNKNOWN STATUS", vpn.status) |