allow custom emoji in user profiles (#475)

fixes #471
This commit is contained in:
Nolan Lawson 2018-08-23 14:47:33 -07:00 committed by GitHub
parent 5fdde8c63f
commit c4c128030e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 17 deletions

View File

@ -30,16 +30,15 @@
} }
</style> </style>
<script> <script>
import { store } from '../../_store/store'
import { massageUserText } from '../../_utils/massageUserText'
export default { export default {
store: () => store,
computed: { computed: {
note: ({ account }) => account.note, note: ({ account }) => account.note,
massagedNote: ({ note }) => { emojis: ({ account }) => account.emojis || [],
// GNU Social / Pleroma don't add <p> tags massagedNote: ({ note, emojis, $autoplayGifs }) => massageUserText(note, emojis, $autoplayGifs)
if (!note.startsWith('<p>')) {
note = `<p>${note}</p>`
}
return note
}
} }
} }
</script> </script>

View File

@ -55,7 +55,7 @@
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { store } from '../../_store/store' import { store } from '../../_store/store'
import { classname } from '../../_utils/classname' import { classname } from '../../_utils/classname'
import { emojifyText } from '../../_utils/emojifyText' import { massageUserText } from '../../_utils/massageUserText'
export default { export default {
oncreate () { oncreate () {
@ -73,15 +73,7 @@
}, },
content: ({ originalStatus }) => (originalStatus.content || ''), content: ({ originalStatus }) => (originalStatus.content || ''),
emojis: ({ originalStatus }) => originalStatus.emojis, emojis: ({ originalStatus }) => originalStatus.emojis,
massagedContent: ({ content, emojis, $autoplayGifs }) => { massagedContent: ({ content, emojis, $autoplayGifs }) => massageUserText(content, emojis, $autoplayGifs)
content = emojifyText(content, emojis, $autoplayGifs)
// GNU Social and Pleroma don't add <p> tags
if (content && !content.startsWith('<p>')) {
content = `<p>${content}</p>`
}
return content
}
}, },
methods: { methods: {
hydrateContent () { hydrateContent () {

View File

@ -0,0 +1,12 @@
import { emojifyText } from './emojifyText'
export function massageUserText (text, emojis, $autoplayGifs) {
text = text || ''
text = emojifyText(text, emojis, $autoplayGifs)
// GNU Social and Pleroma don't add <p> tags
if (text && !text.startsWith('<p>')) {
text = `<p>${text}</p>`
}
return text
}