mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Only create sample habits+dailies when registered through website
This commit is contained in:
@@ -123,6 +123,8 @@ api.registerUser = function(req, res, next) {
|
|||||||
};
|
};
|
||||||
analytics.track('register', analyticsData)
|
analytics.track('register', analyticsData)
|
||||||
|
|
||||||
|
user.registeredThrough = req.headers['x-client']
|
||||||
|
|
||||||
user.save(function(err, savedUser){
|
user.save(function(err, savedUser){
|
||||||
// Clean previous email preferences
|
// Clean previous email preferences
|
||||||
// TODO when emails added to EmailUnsubcription they should use lowercase version
|
// TODO when emails added to EmailUnsubcription they should use lowercase version
|
||||||
|
|||||||
@@ -483,7 +483,13 @@ UserSchema.pre('save', function(next) {
|
|||||||
if (this.isNew){
|
if (this.isNew){
|
||||||
//TODO for some reason this doesn't work here: `_.merge(this, shared.content.userDefaults);`
|
//TODO for some reason this doesn't work here: `_.merge(this, shared.content.userDefaults);`
|
||||||
var self = this;
|
var self = this;
|
||||||
_.each(['habits', 'dailys', 'todos', 'rewards', 'tags'], function(taskType){
|
var taskTypes;
|
||||||
|
if (self.registeredThrough === "habitica-web") {
|
||||||
|
taskTypes = ['habits', 'dailys', 'todos', 'rewards', 'tags'];
|
||||||
|
} else {
|
||||||
|
taskTypes = ['todos', 'tags']
|
||||||
|
}
|
||||||
|
_.each(taskTypes, function(taskType){
|
||||||
self[taskType] = _.map(shared.content.userDefaults[taskType], function(task){
|
self[taskType] = _.map(shared.content.userDefaults[taskType], function(task){
|
||||||
var newTask = _.cloneDeep(task);
|
var newTask = _.cloneDeep(task);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user