[fedi] toot as admin only
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user