mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 16:00:13 +01:00
Move every Users.findOne() to the ReactiveCache
This commit is contained in:
parent
bf48d4371c
commit
6e1ef3d94a
35 changed files with 175 additions and 125 deletions
|
|
@ -503,9 +503,7 @@ Users.attachSchema(
|
|||
|
||||
Users.allow({
|
||||
update(userId, doc) {
|
||||
const user = Users.findOne({
|
||||
_id: userId,
|
||||
});
|
||||
const user = ReactiveCache.getUser(userId);
|
||||
if ((user && user.isAdmin) || (Meteor.user() && Meteor.user().isAdmin))
|
||||
return true;
|
||||
if (!user) {
|
||||
|
|
@ -1445,7 +1443,7 @@ if (Meteor.isServer) {
|
|||
});
|
||||
}
|
||||
Accounts.sendEnrollmentEmail(newUserId);
|
||||
user = Users.findOne(newUserId);
|
||||
user = ReactiveCache.getUser(newUserId);
|
||||
}
|
||||
|
||||
board.addMember(user._id);
|
||||
|
|
@ -1949,9 +1947,7 @@ if (Meteor.isServer) {
|
|||
|
||||
Users.after.insert((userId, doc) => {
|
||||
// HACK
|
||||
doc = Users.findOne({
|
||||
_id: doc._id,
|
||||
});
|
||||
doc = ReactiveCache.getUser(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).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue