summaryrefslogtreecommitdiff
path: root/ui/app/components/main_panel
diff options
context:
space:
mode:
authorSimon Fondrie-Teitler <simonft@riseup.net>2017-05-15 20:16:36 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2017-05-19 20:29:57 +0200
commitfeb2818a275830372e452dba7228bfd322f49bf8 (patch)
tree0c9560906542cf558848cdfa06cf78fedbc1668c /ui/app/components/main_panel
parentf5d50c91dae4208e969f83b47f84d1ee602d09b9 (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.
Diffstat (limited to 'ui/app/components/main_panel')
-rw-r--r--ui/app/components/main_panel/vpn_section.js25
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)