summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/models/users.js b/models/users.js
index 1a021bb7..976e5068 100644
--- a/models/users.js
+++ b/models/users.js
@@ -1075,6 +1075,7 @@ if (Meteor.isServer) {
incrementBoards(_.difference(newIds, oldIds), +1);
});
+ // Override getUserId so that we can TODO get the current userId
const fakeUserId = new Meteor.EnvironmentVariable();
const getUserId = CollectionHooks.getUserId;
CollectionHooks.getUserId = () => {
@@ -1108,6 +1109,10 @@ if (Meteor.isServer) {
});
*/
+ const Future = require('fibers/future');
+ let future1 = new Future();
+ let future2 = new Future();
+ let future3 = new Future();
Boards.insert(
{
title: TAPi18n.__('templates'),
@@ -1135,6 +1140,7 @@ if (Meteor.isServer) {
Users.update(fakeUserId.get(), {
$set: { 'profile.cardTemplatesSwimlaneId': swimlaneId },
});
+ future1.return();
},
);
@@ -1152,6 +1158,7 @@ if (Meteor.isServer) {
Users.update(fakeUserId.get(), {
$set: { 'profile.listTemplatesSwimlaneId': swimlaneId },
});
+ future2.return();
},
);
@@ -1169,15 +1176,22 @@ if (Meteor.isServer) {
Users.update(fakeUserId.get(), {
$set: { 'profile.boardTemplatesSwimlaneId': swimlaneId },
});
+ future3.return();
},
);
},
);
+ // HACK
+ future1.wait();
+ future2.wait();
+ future3.wait();
});
});
}
- Users.after.insert((userId, doc) => {
+ Users.after.insert((userId, doc) => {
+ // HACK
+ doc = Users.findOne({_id: doc._id});
if (doc.createdThroughApi) {
// The admin user should be able to create a user despite disabling registration because
// it is two different things (registration and creation).