Make that theme values are in the expected range

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal 2022-05-25 15:32:50 -07:00 committed by GitHub
parent c89953aa4d
commit dc57aa1863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -253,8 +253,12 @@ async function getThemeSetting({
const json = await sql.sqlCall('getItemById', ['theme-setting']);
// Default to `system` if setting doesn't exist yet
const slowValue = json ? json.value : 'system';
// Default to `system` if setting doesn't exist or is invalid
const setting: unknown = json?.value;
const slowValue =
setting === 'light' || setting === 'dark' || setting === 'system'
? setting
: 'system';
ephemeralConfig.set('theme-setting', slowValue);