mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 12:01:45 +02:00
Merge pull request #339 from toadlyBroodle/main
Prevent author vote manipulation
This commit is contained in:
@@ -71,7 +71,7 @@ fun PollNote(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(vertical = 3.dp)
|
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(
|
ZapVote(
|
||||||
baseNote,
|
baseNote,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
@@ -209,6 +209,16 @@ fun ZapVote(
|
|||||||
)
|
)
|
||||||
.show()
|
.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())) {
|
} else if (pollViewModel.isVoteAmountAtomic() && pollViewModel.isPollOptionZappedBy(pollOption, accountViewModel.userProfile())) {
|
||||||
// only allow one vote per option when min==max, i.e. atomic vote amount specified
|
// only allow one vote per option when min==max, i.e. atomic vote amount specified
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
@@ -290,4 +290,5 @@
|
|||||||
<string name="custom_zaps_add_a_message_example">Thank you for all your work!</string>
|
<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="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>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user