Merge pull request #6555 from Ocelot-Social-Community/6534-chat-room-usertag

feat(webapp): changed usertag in chat messages to user-slug
This commit is contained in:
mahula 2023-07-17 16:01:18 +02:00 committed by GitHub
commit d584efa71f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,6 +272,12 @@ export default {
},
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 {
await this.$apollo.mutate({
mutation: createMessageMutation(),