Correct actionRequired to account for requester
Account for the node being the requester when indicating if action is
required on a circuit by a particular node.
@@ -58,24 +58,21 @@ function ListCircuitsResponse(data) {
}
function awaitingApproval() {
- if (this.status === 'Pending') {
- return true;
+ return this.status === 'Pending';
}
+
+function actionRequired(nodeId) {
+ if (!this.awaitingApproval()) {
return false;
}
-function actionRequired(nodeID) {
- const nodeHasVoted =
- this.proposal.votes.filter(vote => {
- return vote.voter_node_id === nodeID;
- }).length > 0;
-
- if (this.awaitingApproval() && !nodeHasVoted) {
- return true;
- }
+ if (this.proposal.requesterNodeID === nodeId) {
return false;
}
+ return !this.proposal.votes.find(vote => vote.voter_node_id === nodeId);
+}
+
Circuit.prototype.awaitingApproval = awaitingApproval;
Circuit.prototype.actionRequired = actionRequired;
