Merge pull request #339 from toadlyBroodle/main

Prevent author vote manipulation
This commit is contained in:
Vitor Pamplona
2023-04-07 14:43:00 -04:00
committed by GitHub
2 changed files with 12 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ fun PollNote(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(vertical = 3.dp)
) {
if (zappedNote.author == account.userProfile() || zappedNote.isZappedBy(account.userProfile()) == true) {
if (zappedNote.author == account.userProfile() || zappedNote.isZappedBy(account.userProfile())) {
ZapVote(
baseNote,
accountViewModel,
@@ -209,6 +209,16 @@ fun ZapVote(
)
.show()
}
} else if (zappedNote?.author == account.userProfile()) {
scope.launch {
Toast
.makeText(
context,
context.getString(R.string.poll_author_no_vote),
Toast.LENGTH_SHORT
)
.show()
}
} else if (pollViewModel.isVoteAmountAtomic() && pollViewModel.isPollOptionZappedBy(pollOption, accountViewModel.userProfile())) {
// only allow one vote per option when min==max, i.e. atomic vote amount specified
scope.launch {

View File

@@ -290,4 +290,5 @@
<string name="custom_zaps_add_a_message_example">Thank you for all your work!</string>
<string name="lightning_create_and_add_invoice">Create and Add</string>
<string name="poll_author_no_vote">Poll authors can\'t vote in their own polls.</string>
</resources>