From 0b178fc7a0bdff2476d3ae534af1093ebdaf86b3 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 1 Sep 2020 01:40:34 +1200 Subject: [PATCH] Fix default setting merge --- api/utils/getuser.js | 4 ++-- api/utils/youtube.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/utils/getuser.js b/api/utils/getuser.js index 92d147d..c73a18b 100644 --- a/api/utils/getuser.js +++ b/api/utils/getuser.js @@ -33,8 +33,8 @@ class User { getSettingsOrDefaults() { const settings = this.getSettings() - for (const key of Object.keys(settings)) { - if (settings[key] === null) settings[key] = constants.user_settings[key].default + for (const key of Object.keys(constants.user_settings)) { + if (settings[key] == null) settings[key] = constants.user_settings[key].default } return settings } diff --git a/api/utils/youtube.js b/api/utils/youtube.js index 2a41467..dcee701 100644 --- a/api/utils/youtube.js +++ b/api/utils/youtube.js @@ -2,6 +2,7 @@ const fetch = require("node-fetch") const db = require("./db") async function fetchChannel(ucid, instance) { + if (!instance) throw new Error("No instance parameter provided") // fetch const channel = await fetch(`${instance}/api/v1/channels/${ucid}`).then(res => res.json()) // update database