mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 08:32:23 +01:00
feat: add a setting to display federated events in home page (default), fix #495
This commit is contained in:
parent
165c458433
commit
459882cc37
5 changed files with 18 additions and 4 deletions
|
@ -10,6 +10,11 @@ v-container
|
|||
|
||||
template(v-if='enable_federation')
|
||||
|
||||
v-switch.mt-4(v-model='federated_events_in_home'
|
||||
:label="$t('admin.federated_events_in_home')"
|
||||
:hint="$t('admin.federated_events_in_home_help')"
|
||||
persistent-hint inset)
|
||||
|
||||
v-switch.mt-4(v-model='enable_resources'
|
||||
:label="$t('admin.enable_resources')"
|
||||
:hint="$t('admin.enable_resources_help')"
|
||||
|
@ -157,6 +162,10 @@ export default {
|
|||
get () { return this.settings.enable_resources },
|
||||
set (value) { this.setSetting({ key: 'enable_resources', value }) }
|
||||
},
|
||||
federated_events_in_home: {
|
||||
get () { return this.settings.federated_events_in_home },
|
||||
set (value) { this.setSetting({ key: 'federated_events_in_home', value }) }
|
||||
},
|
||||
default_fedi_hashtags: {
|
||||
get () { return this.settings.default_fedi_hashtags },
|
||||
set (value) { this.setSetting({ key: 'default_fedi_hashtags', value }) }
|
||||
|
|
|
@ -350,7 +350,9 @@
|
|||
"custom_js_help": "You can integrate some javascript code that will be loaded for each user by writing in this textarea below. You probably want to read the <a href='https://gancio.org/usage/custom_js'>documentation</a> first.",
|
||||
"custom_css_help": "You can customize some stylesheet too, read some example <a href='https://gancio.org/usage/custom_css'>here</a>.",
|
||||
"default_fedi_hashtags": "Default fediverse hashtags",
|
||||
"default_fedi_hashtags_help": "The specified tags will be added to events sent to the fediverse"
|
||||
"default_fedi_hashtags_help": "The specified tags will be added to events sent to the fediverse",
|
||||
"federated_events_in_home": "Show federated events on the home page",
|
||||
"federated_events_in_home_help": "Incoming events from trusted federated sources will be shown by default on the home page. To only show some events you can use collections"
|
||||
},
|
||||
"auth": {
|
||||
"not_confirmed": "Not confirmed yet…",
|
||||
|
|
|
@ -987,7 +987,7 @@ const eventController = {
|
|||
const page = Number(req.query.page) || 0
|
||||
const older = req.query.older || false
|
||||
|
||||
const show_federated = helpers.queryParamToBool(req.query.show_federated, false)
|
||||
const show_federated = helpers.queryParamToBool(req.query.show_federated, settings.federated_events_in_home)
|
||||
const show_multidate = settings.allow_multidate_event && helpers.queryParamToBool(req.query.show_multidate, true)
|
||||
const show_recurrent = settings.allow_recurrent_event && helpers.queryParamToBool(req.query.show_recurrent, settings.recurrent_event_visible)
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ const defaultSettings = {
|
|||
tilelayer_provider: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
tilelayer_provider_attribution: "<a target=\"_blank\" href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors",
|
||||
enable_federation: true,
|
||||
federated_events_in_home: true,
|
||||
enable_resources: false,
|
||||
hide_boosts: true,
|
||||
enable_trusted_instances: true,
|
||||
|
|
|
@ -105,7 +105,8 @@ module.exports = {
|
|||
collection_in_home: settings.collection_in_home,
|
||||
custom_js: settings.custom_js,
|
||||
custom_css: settings.custom_css,
|
||||
default_fedi_hashtags: settings.default_fedi_hashtags
|
||||
default_fedi_hashtags: settings.default_fedi_hashtags,
|
||||
federated_events_in_home: settings.federated_events_in_home
|
||||
}
|
||||
next()
|
||||
},
|
||||
|
@ -277,6 +278,7 @@ module.exports = {
|
|||
const collectionController = require('./api/controller/collection')
|
||||
const eventController = require('./api/controller/event')
|
||||
const { DateTime } = require('luxon')
|
||||
const show_federated = res.locals.settings.federated_events_in_home
|
||||
const show_multidate = res.locals.settings.allow_multidate_event
|
||||
const show_recurrent = res.locals.settings.allow_recurrent_event
|
||||
const collection_in_home = res.locals.settings.collection_in_home
|
||||
|
@ -286,7 +288,7 @@ module.exports = {
|
|||
collectionController._getVisible(),
|
||||
collection_in_home ?
|
||||
collectionController._getEvents({ name: collection_in_home, start: DateTime.local().toUnixInteger(), show_recurrent }) :
|
||||
eventController._select({ start: DateTime.local().toUnixInteger(), show_multidate, show_recurrent })
|
||||
eventController._select({ start: DateTime.local().toUnixInteger(), show_multidate, show_recurrent, show_federated })
|
||||
])
|
||||
|
||||
res.locals.announcements = ret[0]?.value
|
||||
|
|
Loading…
Reference in a new issue