refactor to avoid unnecessary emojify computations (#143)

This commit is contained in:
Nolan Lawson 2018-04-16 20:54:16 -07:00 committed by GitHub
parent 0e54e15f72
commit 8fb00a961c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -77,10 +77,10 @@
shown && 'shown' shown && 'shown'
) )
}, },
massagedContent: (originalStatus, $autoplayGifs) => { content: (originalStatus) => originalStatus.content,
let content = originalStatus.content emojis: (originalStatus) => originalStatus.emojis,
massagedContent: (content, emojis, $autoplayGifs) => {
content = emojifyText(content, originalStatus.emojis, $autoplayGifs) content = emojifyText(content, emojis, $autoplayGifs)
// GNU Social and Pleroma don't add <p> tags // GNU Social and Pleroma don't add <p> tags
if (!content.startsWith('<p>')) { if (!content.startsWith('<p>')) {

View File

@ -61,9 +61,10 @@
store: () => store, store: () => store,
computed: { computed: {
spoilerText: (originalStatus) => originalStatus.spoiler_text, spoilerText: (originalStatus) => originalStatus.spoiler_text,
massagedSpoilerText: (spoilerText, originalStatus, $autoplayGifs) => { emojis: (originalStatus) => originalStatus.emojis,
massagedSpoilerText: (spoilerText, emojis, $autoplayGifs) => {
spoilerText = escapeHtml(spoilerText) spoilerText = escapeHtml(spoilerText)
return emojifyText(spoilerText, originalStatus.emojis, $autoplayGifs) return emojifyText(spoilerText, emojis, $autoplayGifs)
}, },
delegateKey: (uuid) => `spoiler-${uuid}` delegateKey: (uuid) => `spoiler-${uuid}`
}, },