From 1ff9550e1f485d4f18e1a58b78cbbba8c4abe0bc Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Mon, 2 Sep 2013 20:16:13 +0100 Subject: [PATCH] User property aliases issue #389 - Temporary aliases for user model, schema will be changed soon, in the meantime we want themes to be built using the right properties --- core/server/models/user.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/server/models/user.js b/core/server/models/user.js index 9ff72ab6f9..f5465e5f9b 100644 --- a/core/server/models/user.js +++ b/core/server/models/user.js @@ -45,6 +45,20 @@ User = GhostBookshelf.Model.extend({ }; }, + parse: function (attrs) { + // temporary alias of name for full_name (will get changed in the schema) + if (attrs.full_name && !attrs.name) { + attrs.name = attrs.full_name; + } + + // temporary alias of website for url (will get changed in the schema) + if (attrs.url && !attrs.website) { + attrs.website = attrs.url; + } + + return attrs; + }, + initialize: function () { this.on('saving', this.saving, this); this.on('saving', this.validate, this);