Fix issue with falsey user options getting overridden by truthy defaults

This commit is contained in:
Alistair McKinlay 2017-08-16 09:01:09 +01:00
parent aef1bb3acc
commit bc2a37913f

View File

@ -25,14 +25,16 @@ const options = {
thumbnails: true, thumbnails: true,
userStyles: userStyles.text(), userStyles: userStyles.text(),
}; };
const userOptions = JSON.parse(storage.get("settings")) || {}; let userOptions = JSON.parse(storage.get("settings")) || {};
for (const key in options) { for (const key in options) {
if (userOptions[key]) { if (userOptions[key] !== undefined) {
options[key] = userOptions[key]; options[key] = userOptions[key];
} }
} }
userOptions = null;
module.exports = options; module.exports = options;
module.exports.shouldOpenMessagePreview = function(type) { module.exports.shouldOpenMessagePreview = function(type) {