mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-14 22:59:35 +09: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
@ -5,7 +5,7 @@
|
|||||||
<div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div>
|
<div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div>
|
||||||
<span>
|
<span>
|
||||||
<template v-if="choice.isVoted"><fa icon="check"/></template>
|
<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 class="votes" v-if="showResult">({{ $t('vote-count').replace('{}', choice.votes) }})</span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import es from '../../db/elasticsearch';
|
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 User, { isLocalUser, IUser, isRemoteUser, IRemoteUser, ILocalUser } from '../../models/user';
|
||||||
import { publishMainStream, publishHomeTimelineStream, publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream, publishHashtagStream } from '../../stream';
|
import { publishMainStream, publishHomeTimelineStream, publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream, publishHashtagStream } from '../../stream';
|
||||||
import Following from '../../models/following';
|
import Following from '../../models/following';
|
||||||
@ -25,7 +25,7 @@ import notesChart from '../../chart/notes';
|
|||||||
import perUserNotesChart from '../../chart/per-user-notes';
|
import perUserNotesChart from '../../chart/per-user-notes';
|
||||||
import activeUsersChart from '../../chart/active-users';
|
import activeUsersChart from '../../chart/active-users';
|
||||||
|
|
||||||
import { erase } from '../../prelude/array';
|
import { erase, concat } from '../../prelude/array';
|
||||||
import insertNoteUnread from './unread';
|
import insertNoteUnread from './unread';
|
||||||
import registerInstance from '../register-instance';
|
import registerInstance from '../register-instance';
|
||||||
import Instance from '../../models/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) {
|
if (!tags || !emojis || !mentionedUsers) {
|
||||||
const tokens = data.text ? parse(data.text) : [];
|
const tokens = data.text ? parse(data.text) : [];
|
||||||
const cwTokens = data.cw ? parse(data.cw) : [];
|
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);
|
tags = data.apHashtags || extractHashtags(combinedTokens);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user