Voting own claims validation implemented

This commit is contained in:
Luis Fernando Molina committed 2021-10-14 13:12:41 +02:00
1 parent 0f5520060a
commit 4d5690bcd6
3 files changed
+246 -53

No files matched your search

@@ -273,6 +273,15 @@ function newGovernanceFunctionLibraryVotingProgram() {
node.type !== 'Weight Votes Switch'
) {
currentProgramNode.payload.votingProgram.usedPower = currentProgramNode.payload.votingProgram.usedPower + votes
/*
Here we will validate that users can not vote for their own claims.
*/
let votedUserProfile = UI.projects.visualScripting.utilities.hierarchy.getHiriarchyHead(node.payload.referenceParent)
if (votedUserProfile.id === userProfile.id) {
node.payload.uiObject.setErrorMessage('Voting your own claims is not allowed.')
return
}
distributeProgramPower(
currentProgramNode,
node.payload.referenceParent,