From c4c128030ec60c52b48f1375d70edd2ea335f342 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 23 Aug 2018 14:47:33 -0700 Subject: [PATCH] allow custom emoji in user profiles (#475) fixes #471 --- routes/_components/profile/AccountProfileNote.html | 13 ++++++------- routes/_components/status/StatusContent.html | 12 ++---------- routes/_utils/massageUserText.js | 12 ++++++++++++ 3 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 routes/_utils/massageUserText.js diff --git a/routes/_components/profile/AccountProfileNote.html b/routes/_components/profile/AccountProfileNote.html index 7ca908a..20e97a8 100644 --- a/routes/_components/profile/AccountProfileNote.html +++ b/routes/_components/profile/AccountProfileNote.html @@ -30,16 +30,15 @@ } \ No newline at end of file diff --git a/routes/_components/status/StatusContent.html b/routes/_components/status/StatusContent.html index 245afd6..19f7498 100644 --- a/routes/_components/status/StatusContent.html +++ b/routes/_components/status/StatusContent.html @@ -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

tags - if (content && !content.startsWith('

')) { - content = `

${content}

` - } - return content - } + massagedContent: ({ content, emojis, $autoplayGifs }) => massageUserText(content, emojis, $autoplayGifs) }, methods: { hydrateContent () { diff --git a/routes/_utils/massageUserText.js b/routes/_utils/massageUserText.js new file mode 100644 index 0000000..7c052b6 --- /dev/null +++ b/routes/_utils/massageUserText.js @@ -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

tags + if (text && !text.startsWith('

')) { + text = `

${text}

` + } + return text +}