diff --git a/server/api/models/event.js b/server/api/models/event.js
index 85b140c3..d976ad9b 100644
--- a/server/api/models/event.js
+++ b/server/api/models/event.js
@@ -1,5 +1,6 @@
const config = require('config')
const moment = require('moment-timezone')
+const htmlToText = require('html-to-text')
module.exports = (sequelize, DataTypes) => {
const Event = sequelize.define('event', {
@@ -40,15 +41,17 @@ module.exports = (sequelize, DataTypes) => {
Event.prototype.toAP = function (username, locale, follower = []) {
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, '_'))
- const tag_links = tags.map(t => {
- return `#${t}`
- }).join(' ')
- const content = `${this.title}
- 📍 ${this.place.name}
- 📅 ${moment.unix(this.start_datetime).locale(locale).format('dddd, D MMMM (HH:mm)')}
- ${this.description.length > 500 ? this.description.substr(0, 500) + '...' : this.description}
- ${tag_links}
`
+ const plainDescription = htmlToText.fromString(this.description.replace('\n', '').slice(0, 1000))
+ const summary = `
+ 📍 ${this.place.name}
+ 📅 ${moment.unix(this.start_datetime).locale(locale).format('dddd, D MMMM (HH:mm)')}
+
+ ${plainDescription}
+
+ ${tags.map(t => `#${t}`)}
+
+ `
const attachment = []
if (this.image_path) {
@@ -63,7 +66,7 @@ module.exports = (sequelize, DataTypes) => {
return {
id: `${config.baseurl}/federation/m/${this.id}`,
- url: `${config.baseurl}/federation/m/${this.id}`,
+ url: `${config.baseurl}/event/${this.id}`,
type: 'Event',
attachment,
tag: tags.map(tag => ({
@@ -75,8 +78,8 @@ module.exports = (sequelize, DataTypes) => {
attributedTo: `${config.baseurl}/federation/u/${username}`,
to: follower || [],
cc: ['https://www.w3.org/ns/activitystreams#Public', `${config.baseurl}/federation/u/${username}/followers`],
- content,
- summary: null,
+ name: this.title,
+ summary,
sensitive: false
}
}