From feb2818a275830372e452dba7228bfd322f49bf8 Mon Sep 17 00:00:00 2001 From: Simon Fondrie-Teitler Date: Mon, 15 May 2017 20:16:36 -0400 Subject: [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. --- ui/app/components/main_panel/vpn_section.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'ui') diff --git a/ui/app/components/main_panel/vpn_section.js b/ui/app/components/main_panel/vpn_section.js index 4430ad9..71bbbe1 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) -- cgit v1.2.3