mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
add default fedi hashtags to AP representation on local events
This commit is contained in:
parent
1260d6715d
commit
da0aab13d7
2 changed files with 16 additions and 6 deletions
|
@ -71,6 +71,21 @@ module.exports = (sequelize, DataTypes) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tags = this.tags?.map(tag => ({
|
||||||
|
type: 'Hashtag',
|
||||||
|
name: '#' + tag.tag,
|
||||||
|
href: `${config.baseurl}/tag/${tag.tag}`
|
||||||
|
})) ?? []
|
||||||
|
|
||||||
|
// add default fedi hashtags if needed on local events only
|
||||||
|
if (!this.ap_id && settings.default_fedi_hashtags.length) {
|
||||||
|
settings.default_fedi_hashtags.foreach(t => tags.push({
|
||||||
|
type: 'Hashtag',
|
||||||
|
name: '#' + t,
|
||||||
|
href: `${config.baseurl}/tag/${t}`
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: this?.ap_id ?? `${config.baseurl}/federation/m/${this.id}`,
|
id: this?.ap_id ?? `${config.baseurl}/federation/m/${this.id}`,
|
||||||
name: this.title,
|
name: this.title,
|
||||||
|
@ -86,11 +101,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||||
longitude: this.place.longitude
|
longitude: this.place.longitude
|
||||||
},
|
},
|
||||||
attachment,
|
attachment,
|
||||||
tag: this.tags && this.tags.map(tag => ({
|
tag: tags,
|
||||||
type: 'Hashtag',
|
|
||||||
name: '#' + tag.tag,
|
|
||||||
href: `${config.baseurl}/tag/${tag.tag}`
|
|
||||||
})),
|
|
||||||
published: this.createdAt,
|
published: this.createdAt,
|
||||||
...( type != 'Create' ? { updated: this.updatedAt } : {} ),
|
...( type != 'Create' ? { updated: this.updatedAt } : {} ),
|
||||||
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
||||||
|
|
|
@ -165,7 +165,6 @@ const Helpers = {
|
||||||
"@id": "toot:focalPoint"
|
"@id": "toot:focalPoint"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
body.object.tag.push({type: 'Hashtag', name: config.default_fedi_hashtag, href: `/tags/${config.default_fedi_hashtag}`})
|
|
||||||
const task = new Task({
|
const task = new Task({
|
||||||
name: 'AP',
|
name: 'AP',
|
||||||
method: Helpers.signAndSend,
|
method: Helpers.signAndSend,
|
||||||
|
|
Loading…
Reference in a new issue