0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Merge pull request #5488 from ErisDS/extends

Use extends correctly & consistently
This commit is contained in:
Jason Williams 2015-06-27 22:49:55 -05:00
commit 09402d22f5
9 changed files with 17 additions and 17 deletions

View file

@ -211,7 +211,7 @@ authentication = {
return dataProvider.User.findOne({role: 'Owner', status: 'all'});
}).then(function (ownerUser) {
if (ownerUser) {
return dataProvider.User.setup(setupUser, _.extend(internal, {id: ownerUser.id}));
return dataProvider.User.setup(setupUser, _.extend({id: ownerUser.id}, internal));
} else {
return dataProvider.Role.findOne({name: 'Owner'}).then(function (ownerRole) {
setupUser.roles = [ownerRole.id];

View file

@ -401,9 +401,9 @@ Post = ghostBookshelf.Model.extend({
var withNext = _.contains(options.include, 'next'),
withPrev = _.contains(options.include, 'previous');
data = _.extend({
data = _.defaults(data || {}, {
status: 'published'
}, data || {});
});
if (data.status === 'all') {
delete data.status;

View file

@ -263,9 +263,9 @@ User = ghostBookshelf.Model.extend({
delete data.role;
data = _.extend({
data = _.defaults(data || {}, {
status: 'active'
}, data || {});
});
status = data.status;
delete data.status;

View file

@ -56,9 +56,9 @@ function updateCheckData() {
ops = [],
mailConfig = config.mail;
ops.push(api.settings.read(_.extend(internal, {key: 'dbHash'})).catch(errors.rejectError));
ops.push(api.settings.read(_.extend(internal, {key: 'activeTheme'})).catch(errors.rejectError));
ops.push(api.settings.read(_.extend(internal, {key: 'activeApps'}))
ops.push(api.settings.read(_.extend({key: 'dbHash'}, internal)).catch(errors.rejectError));
ops.push(api.settings.read(_.extend({key: 'activeTheme'}, internal)).catch(errors.rejectError));
ops.push(api.settings.read(_.extend({key: 'activeApps'}, internal))
.then(function (response) {
var apps = response.settings[0];
try {
@ -187,7 +187,7 @@ function updateCheck() {
// No update check
return Promise.resolve();
} else {
return api.settings.read(_.extend(internal, {key: 'nextUpdateCheck'})).then(function then(result) {
return api.settings.read(_.extend({key: 'nextUpdateCheck'}, internal)).then(function then(result) {
var nextUpdateCheck = result.settings[0];
if (nextUpdateCheck && nextUpdateCheck.value && nextUpdateCheck.value > moment().unix()) {
@ -204,7 +204,7 @@ function updateCheck() {
}
function showUpdateNotification() {
return api.settings.read(_.extend(internal, {key: 'displayUpdateNotification'})).then(function then(response) {
return api.settings.read(_.extend({key: 'displayUpdateNotification'}, internal)).then(function then(response) {
var display = response.settings[0];
// Version 0.4 used boolean to indicate the need for an update. This special case is

View file

@ -32,7 +32,7 @@ describe('Configuration API', function () {
should.exist(ConfigurationAPI);
it('can browse config', function (done) {
var updatedConfig = _.extend(config, newConfig);
var updatedConfig = _.extend({}, config, newConfig);
config.set(updatedConfig);
ConfigurationAPI.__set__('config', updatedConfig);
@ -49,7 +49,7 @@ describe('Configuration API', function () {
});
it('can read config', function (done) {
var updatedConfig = _.extend(config, newConfig);
var updatedConfig = _.extend({}, config, newConfig);
config.set(updatedConfig);
ConfigurationAPI.__set__('config', updatedConfig);

View file

@ -122,7 +122,7 @@ describe('Notifications API', function () {
var notification = result.notifications[0];
NotificationsAPI.destroy(
_.extend(testUtils.context.internal, {id: notification.id})
_.extend({}, testUtils.context.internal, {id: notification.id})
).then(function (result) {
should.exist(result);
should.exist(result.notifications);
@ -143,7 +143,7 @@ describe('Notifications API', function () {
var notification = result.notifications[0];
NotificationsAPI.destroy(
_.extend(testUtils.context.owner, {id: notification.id})
_.extend({}, testUtils.context.owner, {id: notification.id})
).then(function (result) {
should.exist(result);
should.exist(result.notifications);

View file

@ -34,7 +34,7 @@ describe('Import', function () {
describe('Resolves', function () {
beforeEach(testUtils.setup());
beforeEach(function () {
var newConfig = _.extend(config, defaultConfig);
var newConfig = _.extend({}, config, defaultConfig);
migration.__get__('config', newConfig);
config.set(newConfig);

View file

@ -17,7 +17,7 @@ describe('Local File System Storage', function () {
var image,
overrideConfig = function (newConfig) {
var existingConfig = LocalFileStore.__get__('config'),
updatedConfig = _.extend(existingConfig, newConfig);
updatedConfig = _.extend({}, existingConfig, newConfig);
config.set(updatedConfig);
LocalFileStore.__set__('config', updatedConfig);
};

View file

@ -55,7 +55,7 @@ function forkGhost(newConfig, envName) {
.then(function (port) {
newConfig.server = newConfig.server || {};
newConfig.server.port = port;
newConfig.url = url.format(_.extend(url.parse(newConfig.url), {port: port, host: null}));
newConfig.url = url.format(_.extend({}, url.parse(newConfig.url), {port: port, host: null}));
var newConfigFile = path.join(config.paths.appRoot, 'config.test' + port + '.js');