aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-14 13:16:08 +0200
committerlain <lain@soykaf.club>2020-06-14 13:16:08 +0200
commitd41c9a717ca3f52b0a67bbb2b0ab8b0c898bba4b (patch)
treeb41fea476224a49a748ae300719040efab473a5e /src
parent7de56a8063e6c8ef1c0f3bbe87428f5887c38485 (diff)
Polls: Construct an html field during normalization.
Diffstat (limited to 'src')
-rw-r--r--src/components/poll/poll.vue8
-rw-r--r--src/services/entity_normalizer/entity_normalizer.service.js6
2 files changed, 13 insertions, 1 deletions
diff --git a/src/components/poll/poll.vue b/src/components/poll/poll.vue
index 56e91cca..28f90006 100644
--- a/src/components/poll/poll.vue
+++ b/src/components/poll/poll.vue
@@ -17,7 +17,7 @@
<span class="result-percentage">
{{ percentageForOption(option.votes_count) }}%
</span>
- <span>{{ option.title }}</span>
+ <span v-html="option.title_html"></span>
</div>
<div
class="result-fill"
@@ -75,6 +75,12 @@
@import '../../_variables.scss';
.poll {
+ img.emoji {
+ vertical-align: middle;
+ object-fit: contain;
+ width: 32px;
+ height: 32px;
+ }
.votes {
display: flex;
flex-direction: column;
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index c7ed65a4..e93eea5b 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -258,6 +258,12 @@ export const parseStatus = (data) => {
output.summary_html = addEmojis(escape(data.spoiler_text), data.emojis)
output.external_url = data.url
output.poll = data.poll
+ if (output.poll) {
+ output.poll.options = (output.poll.options || []).map(field => {
+ field.title_html = addEmojis(field.title, data.emojis)
+ return field
+ })
+ }
output.pinned = data.pinned
output.muted = data.muted
} else {