mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
default fedi hashtags has to be merged with event's tags
This commit is contained in:
parent
da0aab13d7
commit
4376061191
1 changed files with 9 additions and 10 deletions
|
@ -1,3 +1,4 @@
|
|||
const union = require('lodash/union')
|
||||
const config = require('../../config')
|
||||
const { DateTime } = require('luxon')
|
||||
|
||||
|
@ -71,21 +72,19 @@ module.exports = (sequelize, DataTypes) => {
|
|||
})
|
||||
}
|
||||
|
||||
let tags = this.tags?.map(tag => ({
|
||||
type: 'Hashtag',
|
||||
name: '#' + tag.tag,
|
||||
href: `${config.baseurl}/tag/${tag.tag}`
|
||||
})) ?? []
|
||||
let tags = this.tags.map(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}`
|
||||
}))
|
||||
tags = union(tags, settings.default_fedi_hashtags)
|
||||
}
|
||||
|
||||
tags = tags?.map(tag => ({
|
||||
type: 'Hashtag',
|
||||
name: '#' + tag,
|
||||
href: `${config.baseurl}/tag/${tag}`
|
||||
})) ?? []
|
||||
|
||||
return {
|
||||
id: this?.ap_id ?? `${config.baseurl}/federation/m/${this.id}`,
|
||||
name: this.title,
|
||||
|
|
Loading…
Reference in a new issue