Merge pull request #6609 from Ocelot-Social-Community/6568-highlight-username-chat

fix(webapp): highlight username functionality for chat
This commit is contained in:
Hannes Heine 2023-07-19 14:14:24 +02:00 committed by GitHub
commit e419e247b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 6 deletions

View File

@ -30,6 +30,7 @@ const standardSanitizeHtmlOptions = {
'strike', 'strike',
'span', 'span',
'blockquote', 'blockquote',
'usertag',
], ],
allowedAttributes: { allowedAttributes: {
a: ['href', 'class', 'target', 'data-*', 'contenteditable'], a: ['href', 'class', 'target', 'data-*', 'contenteditable'],

View File

@ -352,12 +352,6 @@ export default {
}, },
async sendMessage(message) { async sendMessage(message) {
// check for usersTag and change userid to username
message.usersTag.forEach((userTag) => {
const needle = `<usertag>${userTag.id}</usertag>`
const replacement = `<usertag>@${userTag.name.replaceAll(' ', '-').toLowerCase()}</usertag>`
message.content = message.content.replaceAll(needle, replacement)
})
try { try {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: createMessageMutation(), mutation: createMessageMutation(),