mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 15:23:09 +02:00
Supports Twemoji / CustomEmoji in poll (#3960)
* Supports Twemoji / CustomEmoji in poll * extract emojis in polls
This commit is contained in:
parent
8bf9e87117
commit
fa124abbe2
2 changed files with 8 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
|||
<div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div>
|
||||
<span>
|
||||
<template v-if="choice.isVoted"><fa icon="check"/></template>
|
||||
<span>{{ choice.text }}</span>
|
||||
<mfm :text="choice.text" :should-break="false" :plain-text="true" :custom-emojis="note.emojis"/>
|
||||
<span class="votes" v-if="showResult">({{ $t('vote-count').replace('{}', choice.votes) }})</span>
|
||||
</span>
|
||||
</li>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import es from '../../db/elasticsearch';
|
||||
import Note, { pack, INote } from '../../models/note';
|
||||
import Note, { pack, INote, IChoice } from '../../models/note';
|
||||
import User, { isLocalUser, IUser, isRemoteUser, IRemoteUser, ILocalUser } from '../../models/user';
|
||||
import { publishMainStream, publishHomeTimelineStream, publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream, publishHashtagStream } from '../../stream';
|
||||
import Following from '../../models/following';
|
||||
|
@ -25,7 +25,7 @@ import notesChart from '../../chart/notes';
|
|||
import perUserNotesChart from '../../chart/per-user-notes';
|
||||
import activeUsersChart from '../../chart/active-users';
|
||||
|
||||
import { erase } from '../../prelude/array';
|
||||
import { erase, concat } from '../../prelude/array';
|
||||
import insertNoteUnread from './unread';
|
||||
import registerInstance from '../register-instance';
|
||||
import Instance from '../../models/instance';
|
||||
|
@ -157,7 +157,11 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
|||
if (!tags || !emojis || !mentionedUsers) {
|
||||
const tokens = data.text ? parse(data.text) : [];
|
||||
const cwTokens = data.cw ? parse(data.cw) : [];
|
||||
const combinedTokens = tokens.concat(cwTokens);
|
||||
const choiceTokens = data.poll && data.poll.choices
|
||||
? concat((data.poll.choices as IChoice[]).map(choice => parse(choice.text)))
|
||||
: [];
|
||||
|
||||
const combinedTokens = tokens.concat(cwTokens).concat(choiceTokens);
|
||||
|
||||
tags = data.apHashtags || extractHashtags(combinedTokens);
|
||||
|
||||
|
|
Loading…
Reference in a new issue