mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
[fix] remove space from hashtag in AP
This commit is contained in:
parent
8871e70d37
commit
e6f5372497
1 changed files with 11 additions and 9 deletions
|
@ -38,16 +38,17 @@ module.exports = (sequelize, DataTypes) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
event.prototype.toAP = function (username, follower = []) {
|
event.prototype.toAP = function (username, follower = []) {
|
||||||
const tags = this.tags && this.tags.map(t => {
|
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, ' '))
|
||||||
const tag = t.tag.replace(/[ #]/g, '_')
|
const tag_links = tags.map(t => {
|
||||||
return `<a href='/tags/${t.tag}' class='mention hashtag status-link' rel='tag'><span>#${t.tag}</span></a>`
|
return `<a href='/tags/${t}' class='mention hashtag status-link' rel='tag'><span>#${t}</span></a>`
|
||||||
}).join(' ')
|
}).join(' ')
|
||||||
|
|
||||||
|
// @todo: each instance support different note's length
|
||||||
const content = `<a href='${config.baseurl}/event/${this.id}'>${this.title}</a><br/>
|
const content = `<a href='${config.baseurl}/event/${this.id}'>${this.title}</a><br/>
|
||||||
📍${this.place.name}<br/>
|
📍 ${this.place.name}<br/>
|
||||||
⏰ ${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}<br/><br/>
|
📅 ${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}<br/><br/>
|
||||||
${this.description.length > 200 ? this.description.substr(0, 200) + '...' : this.description}<br/>
|
${this.description.length > 200 ? this.description.substr(0, 200) + '...' : this.description}<br/>
|
||||||
${tags} <br/>`
|
${tag_links} <br/>`
|
||||||
|
|
||||||
const attachment = []
|
const attachment = []
|
||||||
if (this.image_path) {
|
if (this.image_path) {
|
||||||
|
@ -64,11 +65,12 @@ module.exports = (sequelize, DataTypes) => {
|
||||||
id: `${config.baseurl}/federation/m/${this.id}`,
|
id: `${config.baseurl}/federation/m/${this.id}`,
|
||||||
url: `${config.baseurl}/federation/m/${this.id}`,
|
url: `${config.baseurl}/federation/m/${this.id}`,
|
||||||
type: 'Note',
|
type: 'Note',
|
||||||
|
// do not send attachment, in mastodon a link preview is shown instead
|
||||||
// attachment,
|
// attachment,
|
||||||
tag: this.tags.map(tag => ({
|
tag: tags.map(tag => ({
|
||||||
type: 'Hashtag',
|
type: 'Hashtag',
|
||||||
name: '#' + tag.tag,
|
name: '#' + tag,
|
||||||
href: '/tags/' + tag.tag
|
href: '/tags/' + tag
|
||||||
})),
|
})),
|
||||||
published: this.createdAt,
|
published: this.createdAt,
|
||||||
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
||||||
|
|
Loading…
Reference in a new issue