-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
馃敟 馃帹 Themes & settings misc cleanup (#8061)
no issue 馃敟 remove unused loadThemes API method 馃毃 Add tests for themes.readOne 馃敟 Don't update settings cache for imports - this isn't needed as of #8057 - settings.edit fires an event, that will result in the update happening automatically 馃帹 Move validation to themes - slowly collecting all theme-related code together 馃敟 Reduce DEBUG output - all this info is a bit tooooo much!
- Loading branch information
Showing
9 changed files
with
85 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var Promise = require('bluebird'), | ||
config = require('../config'), | ||
errors = require('../errors'), | ||
i18n = require('../i18n'), | ||
validateActiveTheme; | ||
|
||
// @TODO replace this with something PROPER - we should probably attempt to read the theme from the | ||
// File system at this point and validate the theme using gscan rather than just checking if it's in a cache object | ||
validateActiveTheme = function validateActiveTheme(themeName) { | ||
if (!config.get('paths').availableThemes || Object.keys(config.get('paths').availableThemes).length === 0) { | ||
// We haven't yet loaded all themes, this is probably being called early? | ||
return Promise.resolve(); | ||
} | ||
|
||
// Else, if we have a list, check if the theme is in it | ||
if (!config.get('paths').availableThemes.hasOwnProperty(themeName)) { | ||
return Promise.reject(new errors.ValidationError({message: i18n.t('notices.data.validation.index.themeCannotBeActivated', {themeName: themeName}), context: 'activeTheme'})); | ||
} | ||
}; | ||
|
||
module.exports.activeTheme = validateActiveTheme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters