Navigation Menu

Skip to content

Commit

Permalink
Abstracting away the deprecatedItems
Browse files Browse the repository at this point in the history
Closes #4189

* moved `deprecatedItems` from within the function to the default config object
* addes tests
  • Loading branch information
javorszky committed Oct 12, 2014
1 parent ce46248 commit 938b098
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/server/config/index.js
Expand Up @@ -144,7 +144,8 @@ ConfigManager.prototype.set = function (config) {
// Used by the upload API to limit uploads to images
extensions: ['.jpg', '.jpeg', '.gif', '.png', '.svg', '.svgz'],
contentTypes: ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml']
}
},
deprecatedItems: ['updateCheck', 'mail.fromaddress']
});

// Also pass config object to
Expand Down Expand Up @@ -324,10 +325,8 @@ ConfigManager.prototype.isPrivacyDisabled = function (privacyFlag) {
* Check if any of the currently set config items are deprecated, and issues a warning.
*/
ConfigManager.prototype.checkDeprecated = function () {
var deprecatedItems = ['updateCheck', 'mail.fromaddress'],
self = this;

_.each(deprecatedItems, function (property) {
var self = this;
_.each(this.deprecatedItems, function (property) {
self.displayDeprecated(self, property.split('.'), []);
});
};
Expand Down
9 changes: 9 additions & 0 deletions core/test/unit/config_spec.js
Expand Up @@ -795,5 +795,14 @@ describe('Config', function () {
// Future tests: This is important here!
resetEnvironment();
});

it('can not modify the deprecatedItems on the config object', function () {
config.set({
deprecatedItems: ['foo']
});

config.deprecatedItems.should.not.equal(['foo']);
resetEnvironment();
});
});
});

0 comments on commit 938b098

Please sign in to comment.