Merge pull request #4269 from javorszky/iss4189

Abstracting away the deprecatedItems
This commit is contained in:
Matt Enlow 2014-10-13 09:28:14 -06:00
commit f518782c3c
2 changed files with 13 additions and 5 deletions

View File

@ -144,7 +144,8 @@ ConfigManager.prototype.set = function (config) {
// Used by the upload API to limit uploads to images // Used by the upload API to limit uploads to images
extensions: ['.jpg', '.jpeg', '.gif', '.png', '.svg', '.svgz'], extensions: ['.jpg', '.jpeg', '.gif', '.png', '.svg', '.svgz'],
contentTypes: ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml'] contentTypes: ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml']
} },
deprecatedItems: ['updateCheck', 'mail.fromaddress']
}); });
// Also pass config object to // Also pass config object to
@ -324,10 +325,8 @@ ConfigManager.prototype.isPrivacyDisabled = function (privacyFlag) {
* Check if any of the currently set config items are deprecated, and issues a warning. * Check if any of the currently set config items are deprecated, and issues a warning.
*/ */
ConfigManager.prototype.checkDeprecated = function () { ConfigManager.prototype.checkDeprecated = function () {
var deprecatedItems = ['updateCheck', 'mail.fromaddress'], var self = this;
self = this; _.each(this.deprecatedItems, function (property) {
_.each(deprecatedItems, function (property) {
self.displayDeprecated(self, property.split('.'), []); self.displayDeprecated(self, property.split('.'), []);
}); });
}; };

View File

@ -795,5 +795,14 @@ describe('Config', function () {
// Future tests: This is important here! // Future tests: This is important here!
resetEnvironment(); resetEnvironment();
}); });
it('can not modify the deprecatedItems on the config object', function () {
config.set({
deprecatedItems: ['foo']
});
config.deprecatedItems.should.not.equal(['foo']);
resetEnvironment();
});
}); });
}); });