support richcontent in polls

This commit is contained in:
Henry Jameson 2021-08-13 12:19:57 +03:00
parent add5921b8b
commit 6c6df29ed3
4 changed files with 11 additions and 9 deletions

View File

@ -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' import { forEach, map } from 'lodash'
export default { export default {
name: 'Poll', name: 'Poll',
props: ['basePoll'], props: ['basePoll', 'emoji'],
components: { Timeago }, components: {
Timeago,
RichContent
},
data () { data () {
return { return {
loading: false, loading: false,

View File

@ -17,8 +17,7 @@
<span class="result-percentage"> <span class="result-percentage">
{{ percentageForOption(option.votes_count) }}% {{ percentageForOption(option.votes_count) }}%
</span> </span>
<!-- eslint-disable-next-line vue/no-v-html --> <RichContent :html="option.title_html" :handle-links="false" :emoji="emoji" />
<span v-html="option.title_html" />
</div> </div>
<div <div
class="result-fill" class="result-fill"
@ -42,8 +41,7 @@
:value="index" :value="index"
> >
<label class="option-vote"> <label class="option-vote">
<!-- eslint-disable-next-line vue/no-v-html --> <RichContent :html="option.title_html" :handle-links="false" :emoji="emoji" />
<div v-html="option.title_html" />
</label> </label>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
@parseReady="$emit('parseReady', $event)" @parseReady="$emit('parseReady', $event)"
> >
<div v-if="status.poll && status.poll.options"> <div v-if="status.poll && status.poll.options">
<poll :base-poll="status.poll" /> <poll :base-poll="status.poll" :emoji="status.emojis" />
</div> </div>
<div <div

View File

@ -301,7 +301,7 @@ export const parseStatus = (data) => {
if (output.poll) { if (output.poll) {
output.poll.options = (output.poll.options || []).map(field => ({ output.poll.options = (output.poll.options || []).map(field => ({
...field, ...field,
title_html: addEmojis(escape(field.title), data.emojis) title_html: escape(field.title)
})) }))
} }
output.pinned = data.pinned output.pinned = data.pinned