Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔥 🎨 No more updateSettingsCache (#8090)
no issue 🔥 Remove unnecessary cache update 🎨 simplify updateSettingsCache() 🎨 Simplify readSettingsResult - although this is more code, it's now much clearer what happens in the two cases 🎨 Don't use readSettingResult for edit 🎨 Simplify updateSettingsCache further 🔥 Remove now unused readSettingsResult 🎨 Change populateDefault to return all 🎨 Move the findAll call out of updateSettingsCache 🔥 Remove updateSettingsCache!! 🎨 Restructure init & finish up settingsCache - move initialisation into settingsCache.init AT LAST - change settingCache to use cloneDeep, so that the object can't be modified outside of the functions - add lots of docs to settings cache 🎨 Cleanup db api endpoints 🔥 Don't populate settings in migrations
- Loading branch information
Showing
7 changed files
with
94 additions
and
107 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,23 +1,19 @@ | ||
/** | ||
* Settings Lib | ||
* A collection of utilities for handling settings including a cache | ||
* @TODO: eventually much of this logic will move into this lib | ||
* For now we are providing a unified interface | ||
*/ | ||
|
||
var SettingsModel = require('../models/settings').Settings, | ||
SettingsAPI = require('../api').settings, | ||
SettingsCache = require('./cache'); | ||
|
||
module.exports = { | ||
init: function init() { | ||
// Bind to events | ||
SettingsCache.init(); | ||
// Update the defaults | ||
return SettingsModel.populateDefaults() | ||
.then(function () { | ||
// Reset the cache | ||
return SettingsAPI.updateSettingsCache(); | ||
.then(function (settingsCollection) { | ||
// Initialise the cache with the result | ||
// This will bind to events for further updates | ||
SettingsCache.init(settingsCollection); | ||
}); | ||
} | ||
}; |
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