logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 6c6df29ed3b76ee5f2e6ba43a6185ff66b91aace
parent add5921b8b3579b153bef6ee2b1916227016d200
Author: Henry Jameson <me@hjkos.com>
Date:   Fri, 13 Aug 2021 12:19:57 +0300

support richcontent in polls

Diffstat:

Msrc/components/poll/poll.js10+++++++---
Msrc/components/poll/poll.vue6++----
Msrc/components/status_content/status_content.vue2+-
Msrc/services/entity_normalizer/entity_normalizer.service.js2+-
4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/components/poll/poll.js b/src/components/poll/poll.js @@ -1,10 +1,14 @@ -import Timeago from '../timeago/timeago.vue' +import Timeago from 'components/timeago/timeago.vue' +import RichContent from 'components/rich_content/rich_content.jsx' import { forEach, map } from 'lodash' export default { name: 'Poll', - props: ['basePoll'], - components: { Timeago }, + props: ['basePoll', 'emoji'], + components: { + Timeago, + RichContent + }, data () { return { loading: false, diff --git a/src/components/poll/poll.vue b/src/components/poll/poll.vue @@ -17,8 +17,7 @@ <span class="result-percentage"> {{ percentageForOption(option.votes_count) }}% </span> - <!-- eslint-disable-next-line vue/no-v-html --> - <span v-html="option.title_html" /> + <RichContent :html="option.title_html" :handle-links="false" :emoji="emoji" /> </div> <div class="result-fill" @@ -42,8 +41,7 @@ :value="index" > <label class="option-vote"> - <!-- eslint-disable-next-line vue/no-v-html --> - <div v-html="option.title_html" /> + <RichContent :html="option.title_html" :handle-links="false" :emoji="emoji" /> </label> </div> </div> diff --git a/src/components/status_content/status_content.vue b/src/components/status_content/status_content.vue @@ -7,7 +7,7 @@ @parseReady="$emit('parseReady', $event)" > <div v-if="status.poll && status.poll.options"> - <poll :base-poll="status.poll" /> + <poll :base-poll="status.poll" :emoji="status.emojis" /> </div> <div diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js @@ -301,7 +301,7 @@ export const parseStatus = (data) => { if (output.poll) { output.poll.options = (output.poll.options || []).map(field => ({ ...field, - title_html: addEmojis(escape(field.title), data.emojis) + title_html: escape(field.title) })) } output.pinned = data.pinned