Render unicode emoji in polls using emoji pack
Port 4407f07014
to glitch-soc
This commit is contained in:
parent
4806232997
commit
7f32d675b0
|
@ -1,4 +1,4 @@
|
||||||
import { normalizeAccount, normalizeStatus } from './normalizer';
|
import { normalizeAccount, normalizeStatus, normalizePoll } from './normalizer';
|
||||||
|
|
||||||
export const ACCOUNT_IMPORT = 'ACCOUNT_IMPORT';
|
export const ACCOUNT_IMPORT = 'ACCOUNT_IMPORT';
|
||||||
export const ACCOUNTS_IMPORT = 'ACCOUNTS_IMPORT';
|
export const ACCOUNTS_IMPORT = 'ACCOUNTS_IMPORT';
|
||||||
|
@ -71,7 +71,7 @@ export function importFetchedStatuses(statuses) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.poll && status.poll.id) {
|
if (status.poll && status.poll.id) {
|
||||||
pushUnique(polls, status.poll);
|
pushUnique(polls, normalizePoll(status.poll));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,3 +65,14 @@ export function normalizeStatus(status, normalOldStatus) {
|
||||||
|
|
||||||
return normalStatus;
|
return normalStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizePoll(poll) {
|
||||||
|
const normalPoll = { ...poll };
|
||||||
|
|
||||||
|
normalPoll.options = poll.options.map(option => ({
|
||||||
|
...option,
|
||||||
|
title_emojified: emojify(escapeTextContentForBrowser(option.title)),
|
||||||
|
}));
|
||||||
|
|
||||||
|
return normalPoll;
|
||||||
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ class Poll extends ImmutablePureComponent {
|
||||||
{!showResults && <span className={classNames('poll__input', { checkbox: poll.get('multiple'), active })} />}
|
{!showResults && <span className={classNames('poll__input', { checkbox: poll.get('multiple'), active })} />}
|
||||||
{showResults && <span className='poll__number'>{Math.round(percent)}%</span>}
|
{showResults && <span className='poll__number'>{Math.round(percent)}%</span>}
|
||||||
|
|
||||||
{option.get('title')}
|
<span dangerouslySetInnerHTML={{ __html: option.get('title_emojified') }} />
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue