Close open connections when closing their need
Issue
Get all existing connections of the need we close and close the active ones.
@@ -355,13 +355,16 @@ export function needsClose(needUri) {
message: data.message
}));
+ //Close all the open connections of the need
const affectedConnections = getState().getIn(['needs', needUri, 'connections']).map(conn => conn && conn.get("uri"));
-
for (con in affectedConnections.toJS()) {
console.log("Connection: " + con);
+ var conState = getState().getIn(['needs', needUri, 'connections', con, 'state'])
+ if(conState == won.WON.Active) {
dispatch(actionCreators.connections__close(con),
)
}
+ }
})
.then(() =>
// assume close went through successfully, update GUI
