diff options
author | ThibG <thib@sitedethib.com> | 2019-03-20 20:13:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 20:13:22 +0100 |
commit | bde9196b70299405ebe9b16500b7a3f65539b2c3 (patch) | |
tree | 4bec904a28c70b916d18055f8291f17c2e58e07b /app/javascript/flavours/glitch/components | |
parent | b9a998f201913dd1c89ddcb0c4c9e181eb73bfcf (diff) | |
parent | 8b5b686f087f99d1a2b54e0760add8180d77fa7e (diff) |
Merge pull request #964 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/components')
-rw-r--r-- | app/javascript/flavours/glitch/components/poll.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/poll.js b/app/javascript/flavours/glitch/components/poll.js index a1b297ce7..56331cb29 100644 --- a/app/javascript/flavours/glitch/components/poll.js +++ b/app/javascript/flavours/glitch/components/poll.js @@ -44,6 +44,11 @@ const timeRemainingString = (intl, date, now) => { return relativeTime; }; +const makeEmojiMap = record => record.get('emojis').reduce((obj, emoji) => { + obj[`:${emoji.get('shortcode')}:`] = emoji.toJS(); + return obj; +}, {}); + export default @injectIntl class Poll extends ImmutablePureComponent { @@ -99,6 +104,12 @@ class Poll extends ImmutablePureComponent { const active = !!this.state.selected[`${optionIndex}`]; const showResults = poll.get('voted') || poll.get('expired'); + let titleEmojified = option.get('title_emojified'); + if (!titleEmojified) { + const emojiMap = makeEmojiMap(poll); + titleEmojified = emojify(escapeTextContentForBrowser(option.get('title')), emojiMap); + } + return ( <li key={option.get('title')}> {showResults && ( @@ -122,7 +133,7 @@ class Poll extends ImmutablePureComponent { {!showResults && <span className={classNames('poll__input', { checkbox: poll.get('multiple'), active })} />} {showResults && <span className='poll__number'>{Math.round(percent)}%</span>} - <span dangerouslySetInnerHTML={{ __html: option.get('title_emojified', emojify(escapeTextContentForBrowser(option.get('title')))) }} /> + <span dangerouslySetInnerHTML={{ __html: titleEmojified }} /> </label> </li> ); |