more on slugify
This commit is contained in:
@@ -90,7 +90,6 @@ const eventController = {
|
||||
const is_admin = req.user && req.user.is_admin
|
||||
const slug = req.params.event_id
|
||||
const id = Number(req.params.event_id) || -1
|
||||
console.error(slug)
|
||||
let event
|
||||
|
||||
try {
|
||||
@@ -127,7 +126,6 @@ const eventController = {
|
||||
return res.sendStatus(400)
|
||||
}
|
||||
|
||||
console.error('diocane')
|
||||
// get prev and next event
|
||||
const next = await Event.findOne({
|
||||
attributes: ['id'],
|
||||
|
||||
@@ -72,7 +72,7 @@ const exportController = {
|
||||
title: `[${req.settings.title}] ${e.title}`,
|
||||
description: e.description,
|
||||
location: `${e.place.name} - ${e.place.address}`,
|
||||
url: `${req.settings.baseurl}/event/${e.id}`,
|
||||
url: `${req.settings.baseurl}/event/${e.slug || e.id}`,
|
||||
alarms
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const config = require('config')
|
||||
const moment = require('dayjs')
|
||||
const htmlToText = require('html-to-text')
|
||||
const { htmlToText } = require('html-to-text')
|
||||
|
||||
const { Model, DataTypes } = require('sequelize')
|
||||
const SequelizeSlugify = require('sequelize-slugify')
|
||||
@@ -72,7 +72,7 @@ SequelizeSlugify.slugifyModel(Event, { source: ['title'] })
|
||||
|
||||
Event.prototype.toAPNote = function (username, locale, to = []) {
|
||||
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, '_'))
|
||||
const plainDescription = htmlToText.fromString(this.description && this.description.replace('\n', '').slice(0, 1000))
|
||||
const plainDescription = htmlToText(this.description && this.description.replace('\n', '').slice(0, 1000))
|
||||
const content = `
|
||||
${this.title}<br/><br/>
|
||||
📍 ${this.place && this.place.name}<br/>
|
||||
@@ -80,7 +80,7 @@ Event.prototype.toAPNote = function (username, locale, to = []) {
|
||||
|
||||
${plainDescription}<br/><br/>
|
||||
|
||||
<a href='${config.baseurl}/event/${this.id}'>${config.baseurl}/event/${this.id}</a><br/>
|
||||
<a href='${config.baseurl}/event/${this.slug || this.id}'>${config.baseurl}/event/${this.slug || this.id}</a><br/>
|
||||
|
||||
${tags && tags.map(t => `#${t}`)}
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user