[fedi] toot as admin only

This commit is contained in:
les
2019-09-26 22:46:04 +02:00
parent a4837daa18
commit 848d7b4da4
6 changed files with 32 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
const { setting: Setting } = require('../models')
const { setting: Setting, user: User } = require('../models')
const config = require('config')
const consola = require('consola')
const path = require('path')
@@ -26,6 +26,12 @@ const settingsController = {
}
})
// set fediverse admin actor
const fedi_admin = await User.findOne({ where: { email: config.admin_email }})
if (fedi_admin) {
settingsController.settings['fedi_admin'] = fedi_admin.username
}
// // initialize user_locale
if (config.user_locale && fs.existsSync(path.resolve(config.user_locale))) {
const user_locale = fs.readdirSync(path.resolve(config.user_locale))

View File

@@ -38,7 +38,8 @@ module.exports = (sequelize, DataTypes) => {
//
event.prototype.toAP = function (username, follower = []) {
const tags = this.tags && this.tags.map(t => '#' + t.tag).join(' ')
const tags = this.tags && this.tags.map(t => `<a href='/tags/${t.tag}' class='mention hashtag' rel='tag'>#${t.tag}</a>`).join(' ')
const content = `<a href='${config.baseurl}/event/${this.id}'>${this.title}</a><br/>
📍${this.place.name}<br/>
${moment.unix(this.start_datetime).format('dddd, D MMMM (HH:mm)')}<br/><br/>
@@ -57,13 +58,14 @@ module.exports = (sequelize, DataTypes) => {
}
return {
type: 'Note',
id: `${config.baseurl}/federation/m/${this.id}`,
url: `${config.baseurl}/federation/m/${this.id}`,
attachment,
type: 'Note',
// attachment,
tag: this.tags.map(tag => ({
type: 'Hashtag',
name: '#' + tag.tag
name: '#' + tag.tag,
href: '/tags/' + tag.tag
})),
published: this.createdAt,
attributedTo: `${config.baseurl}/federation/u/${username}`,
@@ -72,7 +74,12 @@ module.exports = (sequelize, DataTypes) => {
content,
summary: null,
sensitive: false,
// }
startTime: moment.unix(this.start_datetime),
location: {
type: 'Place',
name: this.place.name,
address: this.place.address
}
}
}