diff --git a/server/api/models/event.js b/server/api/models/event.js
index 867e29d9..bf083b2e 100644
--- a/server/api/models/event.js
+++ b/server/api/models/event.js
@@ -38,16 +38,17 @@ module.exports = (sequelize, DataTypes) => {
}
event.prototype.toAP = function (username, follower = []) {
- const tags = this.tags && this.tags.map(t => {
- const tag = t.tag.replace(/[ #]/g, '_')
- return `#${t.tag}`
+ const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, ' '))
+ const tag_links = tags.map(t => {
+ return `#${t}`
}).join(' ')
+ // @todo: each instance support different note's length
const content = `${this.title}
- 📍${this.place.name}
- ⏰ ${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}
+ 📍 ${this.place.name}
+ 📅 ${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}
${this.description.length > 200 ? this.description.substr(0, 200) + '...' : this.description}
- ${tags}
`
+ ${tag_links}
`
const attachment = []
if (this.image_path) {
@@ -64,11 +65,12 @@ module.exports = (sequelize, DataTypes) => {
id: `${config.baseurl}/federation/m/${this.id}`,
url: `${config.baseurl}/federation/m/${this.id}`,
type: 'Note',
+ // do not send attachment, in mastodon a link preview is shown instead
// attachment,
- tag: this.tags.map(tag => ({
+ tag: tags.map(tag => ({
type: 'Hashtag',
- name: '#' + tag.tag,
- href: '/tags/' + tag.tag
+ name: '#' + tag,
+ href: '/tags/' + tag
})),
published: this.createdAt,
attributedTo: `${config.baseurl}/federation/u/${username}`,