show event author in event page if admin is browsing and feature is enabled from config file
This commit is contained in:
@@ -10,7 +10,7 @@ const helpers = require('../../helpers')
|
||||
const Col = helpers.col
|
||||
const notifier = require('../../notifier')
|
||||
|
||||
const { Event, Resource, Tag, Place, Notification, APUser } = require('../models/models')
|
||||
const { Event, Resource, Tag, Place, Notification, User, APUser } = require('../models/models')
|
||||
|
||||
|
||||
const exportController = require('./export')
|
||||
@@ -100,6 +100,7 @@ const eventController = {
|
||||
|
||||
async get(req, res) {
|
||||
const format = req.params.format || 'json'
|
||||
const settings = res.locals.settings
|
||||
const is_admin = req.user && req.user.is_admin
|
||||
const slug = req.params.event_slug
|
||||
|
||||
@@ -128,7 +129,8 @@ const eventController = {
|
||||
required: false,
|
||||
attributes: ['id', 'activitypub_id', 'data', 'hidden']
|
||||
},
|
||||
{ model: Event, required: false, as: 'parent', attributes: ['id', 'recurrent', 'is_visible', 'start_datetime'] }
|
||||
{ model: Event, required: false, as: 'parent', attributes: ['id', 'recurrent', 'is_visible', 'start_datetime'] },
|
||||
...((is_admin && settings.show_event_author_to_admin) ? [{model: User, attributes: ['email']}] : [])
|
||||
],
|
||||
order: [[Resource, 'id', 'DESC']]
|
||||
})
|
||||
|
||||
@@ -29,6 +29,7 @@ const defaultSettings = {
|
||||
allow_recurrent_event: false,
|
||||
allow_online_event: true,
|
||||
recurrent_event_visible: false,
|
||||
show_event_author_to_admin: config.show_event_author_to_admin || false,
|
||||
allow_geolocation: false,
|
||||
geocoding_provider_type: 'Nominatim',
|
||||
geocoding_provider: 'https://nominatim.openstreetmap.org/search',
|
||||
|
||||
Reference in New Issue
Block a user