From f4ca625fea2926d2354fe86e3b1c379390c9b1b3 Mon Sep 17 00:00:00 2001 From: lesion Date: Tue, 8 Aug 2023 23:10:59 +0200 Subject: [PATCH] remove htmlToText from client --- pages/event/_slug.vue | 4 +--- server/api/controller/event.js | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/event/_slug.vue b/pages/event/_slug.vue index 9d353219..1dcda560 100644 --- a/pages/event/_slug.vue +++ b/pages/event/_slug.vue @@ -187,8 +187,6 @@ import EventAdmin from '@/components/eventAdmin' import EmbedEvent from '@/components/embedEvent' import EventMapDialog from '@/components/EventMapDialog' -const { htmlToText } = require('html-to-text') - import { mdiArrowLeft, mdiArrowRight, mdiDotsVertical, mdiCodeTags, mdiClose, mdiMap, mdiEye, mdiEyeOff, mdiDelete, mdiRepeat, mdiLock, mdiFileDownloadOutline, mdiShareAll, mdiCalendarExport, mdiCalendar, mdiContentCopy, mdiMapMarker, mdiChevronUp, mdiMonitorAccount, mdiBookmark } from '@mdi/js' @@ -311,7 +309,7 @@ export default { return this.event.media && this.event.media.length }, plainDescription () { - return htmlToText(this.event.description && this.event.description.replace('\n', '').slice(0, 1000)) + return this.event.plain_description || '' }, currentAttachmentLabel () { return get(this.selectedResource, `data.attachment[${this.currentAttachment}].name`, '') diff --git a/server/api/controller/event.js b/server/api/controller/event.js index d664141d..be00d0e1 100644 --- a/server/api/controller/event.js +++ b/server/api/controller/event.js @@ -9,6 +9,7 @@ const { DateTime } = require('luxon') const helpers = require('../../helpers') const Col = helpers.col const notifier = require('../../notifier') +const { htmlToText } = require('html-to-text') const { Event, Resource, Tag, Place, Notification, APUser } = require('../models/models') @@ -181,6 +182,8 @@ const eventController = { event.next = next && (next.slug || next.id) event.prev = prev && (prev.slug || prev.id) event.tags = event.tags.map(t => t.tag) + event.plain_description = htmlToText(event.description, event.description.replace('\n', '').slice(0, 1000) ) + if (format === 'json') { res.json(event) } else if (format === 'ics') {