s/toAPNote/toAPEvent/
This commit is contained in:
@@ -71,7 +71,7 @@ Event.belongsTo(Event, { as: 'parent' })
|
|||||||
|
|
||||||
SequelizeSlugify.slugifyModel(Event, { source: ['title'], overwrite: false })
|
SequelizeSlugify.slugifyModel(Event, { source: ['title'], overwrite: false })
|
||||||
|
|
||||||
Event.prototype.toAPNote = function (username, locale, to = []) {
|
Event.prototype.toAP = function (username, locale, to = []) {
|
||||||
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, '_'))
|
const tags = this.tags && this.tags.map(t => t.tag.replace(/[ #]/g, '_'))
|
||||||
const plainDescription = htmlToText(this.description && this.description.replace('\n', '').slice(0, 1000))
|
const plainDescription = htmlToText(this.description && this.description.replace('\n', '').slice(0, 1000))
|
||||||
const content = `
|
const content = `
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ const Helpers = {
|
|||||||
to: ['https://www.w3.org/ns/activitystreams#Public'],
|
to: ['https://www.w3.org/ns/activitystreams#Public'],
|
||||||
cc: [...recipients[sharedInbox], `${config.baseurl}/federation/u/${settingsController.settings.instance_name}/followers`],
|
cc: [...recipients[sharedInbox], `${config.baseurl}/federation/u/${settingsController.settings.instance_name}/followers`],
|
||||||
actor: `${config.baseurl}/federation/u/${settingsController.settings.instance_name}`,
|
actor: `${config.baseurl}/federation/u/${settingsController.settings.instance_name}`,
|
||||||
object: event.toAPNote(settingsController.settings.instance_name,
|
object: event.toAP(settingsController.settings.instance_name,
|
||||||
settingsController.settings.instance_locale,
|
settingsController.settings.instance_locale,
|
||||||
recipients[sharedInbox])
|
recipients[sharedInbox])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ router.get('/m/:event_id', async (req, res) => {
|
|||||||
|
|
||||||
const event = await Event.findByPk(req.params.event_id, { include: [User, Tag, Place] })
|
const event = await Event.findByPk(req.params.event_id, { include: [User, Tag, Place] })
|
||||||
if (!event) { return res.status(404).send('Not found') }
|
if (!event) { return res.status(404).send('Not found') }
|
||||||
return res.json(event.toAPNote(settingsController.settings.instance_name, req.settings.instance_locale))
|
return res.json(event.toAP(settingsController.settings.instance_name, req.settings.instance_locale))
|
||||||
})
|
})
|
||||||
|
|
||||||
// get any message coming from federation
|
// get any message coming from federation
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ module.exports = {
|
|||||||
cc: [`${config.baseurl}/federation/u/${name}/followers`],
|
cc: [`${config.baseurl}/federation/u/${name}/followers`],
|
||||||
published: dayjs(e.createdAt).utc().format(),
|
published: dayjs(e.createdAt).utc().format(),
|
||||||
actor: `${config.baseurl}/federation/u/${name}`,
|
actor: `${config.baseurl}/federation/u/${name}`,
|
||||||
object: e.toAPNote(name, req.settings.instance_locale)
|
object: e.toAP(name, req.settings.instance_locale)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -160,7 +160,7 @@ module.exports = {
|
|||||||
// cc: [`${config.baseurl}/federation/u/${name}/followers`],
|
// cc: [`${config.baseurl}/federation/u/${name}/followers`],
|
||||||
// published: dayjs(e.createdAt).utc().format(),
|
// published: dayjs(e.createdAt).utc().format(),
|
||||||
// actor: `${config.baseurl}/federation/u/${name}`,
|
// actor: `${config.baseurl}/federation/u/${name}`,
|
||||||
// object: e.toAPNote(name, req.settings.locale)
|
// object: e.toAP(name, req.settings.locale)
|
||||||
// }))
|
// }))
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user