about summary refs log tree commit diff
path: root/app/javascript/mastodon/actions/importer/normalizer.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-09-22 14:15:18 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-09-22 14:15:18 +0200
commitb359974d9b356bb723fe046466b178328cf9bbaf (patch)
treebf8cb3887286aaced76a46ab80c7e250afbb763e /app/javascript/mastodon/actions/importer/normalizer.js
parent26b810561a5b7cfd1766699358d998b5882a5876 (diff)
Show user what options they have voted (#11195)
* Add own_votes field to poll results in REST API

Fixes #10679

* Display user votes in WebUI

* Update styling

* Add vote checkmark to public pages
Diffstat (limited to 'app/javascript/mastodon/actions/importer/normalizer.js')
-rw-r--r--app/javascript/mastodon/actions/importer/normalizer.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/actions/importer/normalizer.js b/app/javascript/mastodon/actions/importer/normalizer.js
index 5e7e78e69..f7108fdb9 100644
--- a/app/javascript/mastodon/actions/importer/normalizer.js
+++ b/app/javascript/mastodon/actions/importer/normalizer.js
@@ -73,8 +73,9 @@ export function normalizePoll(poll) {
 
   const emojiMap = makeEmojiMap(normalPoll);
 
-  normalPoll.options = poll.options.map(option => ({
+  normalPoll.options = poll.options.map((option, index) => ({
     ...option,
+    voted: poll.own_votes && poll.own_votes.includes(index),
     title_emojified: emojify(escapeTextContentForBrowser(option.title), emojiMap),
   }));