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

View File

@ -55,7 +55,7 @@
import { mark, stop } from '../../_utils/marks'
import { store } from '../../_store/store'
import { classname } from '../../_utils/classname'
import { emojifyText } from '../../_utils/emojifyText'
import { massageUserText } from '../../_utils/massageUserText'
export default {
oncreate () {
@ -73,15 +73,7 @@
},
content: ({ originalStatus }) => (originalStatus.content || ''),
emojis: ({ originalStatus }) => originalStatus.emojis,
massagedContent: ({ 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
}
massagedContent: ({ content, emojis, $autoplayGifs }) => massageUserText(content, emojis, $autoplayGifs)
},
methods: {
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
}