Skip to content

Commit

Permalink
hide elections that are not the voter's (#236)
Browse files Browse the repository at this point in the history
* hide elections that are not the voter's

* fix calculateIsVoter
  • Loading branch information
edulix committed May 18, 2022
1 parent 5d6c2e4 commit 6170602
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ angular.module('avBooth')
);
}

function calculateIsVoter(elCredentials) {
return (
!!elCredentials &&
elCredentials.numSuccessfulLoginsAllowed !== -1
);
}

function getElectionCredentials() {
// need to reload in case this changed in success screen..
var credentials = [];
Expand Down Expand Up @@ -74,6 +81,7 @@ angular.module('avBooth')
election.event_id, credentials
);
var canVote = calculateCanVote(elCredentials);
var isVoter = calculateIsVoter(elCredentials);
if (canVote) {
scope.canVote = true;
}
Expand All @@ -88,7 +96,8 @@ angular.module('avBooth')
election,
elCredentials || {},
{
disabled: (!scope.isDemo && !canVote)
disabled: (!scope.isDemo && !canVote),
hidden: (!scope.isDemo && !isVoter)
}
);
if (!!retValue.skipped) {
Expand Down

0 comments on commit 6170602

Please sign in to comment.