Highlight your own votes when displaying poll results (#2242)

* Highlight your own votes when displaying poll results

* Unbreak tests

* Add a checkmark to the description of self-voted options
This commit is contained in:
Levi Bard 2021-09-17 22:12:17 +02:00 committed by GitHub
commit d07c1b098e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 47 additions and 15 deletions

View file

@ -659,9 +659,12 @@ public class NotificationHelper {
StringBuilder builder = new StringBuilder(notification.getStatus().getContent());
builder.append('\n');
Poll poll = notification.getStatus().getPoll();
for(PollOption option: poll.getOptions()) {
List<PollOption> options = poll.getOptions();
for(int i = 0; i < options.size(); ++i) {
PollOption option = options.get(i);
builder.append(buildDescription(option.getTitle(),
PollViewDataKt.calculatePercent(option.getVotesCount(), poll.getVotersCount(), poll.getVotesCount()),
poll.getOwnVotes() != null && poll.getOwnVotes().contains(i),
context));
builder.append('\n');
}