Commit 0f436574 authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Fix demo mode initialization (use the effective user id)

parent 3c32bdbf
Pipeline #407773 passed with stage
in 3 minutes and 38 seconds
......@@ -10,11 +10,12 @@ const log = makeLogger('init');
// Checks if the demo mode is enabled, and set it up if that's the case.
async function checkDemoMode() {
if (process.kresus.forceDemoMode) {
const isDemoModeEnabled = await Setting.findOrCreateDefaultBooleanValue(0, DEMO_MODE);
const userId = process.kresus.user.id;
const isDemoModeEnabled = await Setting.findOrCreateDefaultBooleanValue(userId, DEMO_MODE);
if (!isDemoModeEnabled) {
try {
log.info('Setting up demo mode...');
await DemoController.setupDemoMode(0);
await DemoController.setupDemoMode(userId);
log.info('Done setting up demo mode...');
} catch (err) {
log.error(`Fatal error when setting up demo mode : ${err.message}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment