mirror of
https://github.com/wekan/wekan.git
synced 2026-01-05 17:18:49 +01:00
Move every Users.findOne(idOrFirstObjectSelector, options) to the ReactiveCache
This commit is contained in:
parent
68610e5066
commit
0767f50af8
17 changed files with 43 additions and 33 deletions
|
|
@ -515,7 +515,7 @@ Users.allow({
|
|||
const adminsNumber = Users.find({
|
||||
isAdmin: true,
|
||||
}).count();
|
||||
const { isAdmin } = Users.findOne(
|
||||
const isAdmin = ReactiveCache.getUser(
|
||||
{
|
||||
_id: userId,
|
||||
},
|
||||
|
|
@ -1262,10 +1262,8 @@ if (Meteor.isServer) {
|
|||
from: 'admin',
|
||||
});
|
||||
const user =
|
||||
Users.findOne(username) ||
|
||||
Users.findOne({
|
||||
username,
|
||||
});
|
||||
ReactiveCache.getUser(username) ||
|
||||
ReactiveCache.getUser({ username });
|
||||
if (user) {
|
||||
Users.update(user._id, {
|
||||
$set: {
|
||||
|
|
@ -1305,7 +1303,7 @@ if (Meteor.isServer) {
|
|||
if (Array.isArray(email)) {
|
||||
email = email.shift();
|
||||
}
|
||||
const existingUser = Users.findOne(
|
||||
const existingUser = ReactiveCache.getUser(
|
||||
{
|
||||
'emails.address': email,
|
||||
},
|
||||
|
|
@ -1402,7 +1400,7 @@ if (Meteor.isServer) {
|
|||
const posAt = username.indexOf('@');
|
||||
let user = null;
|
||||
if (posAt >= 0) {
|
||||
user = Users.findOne({
|
||||
user = ReactiveCache.getUser({
|
||||
emails: {
|
||||
$elemMatch: {
|
||||
address: username,
|
||||
|
|
@ -1411,10 +1409,8 @@ if (Meteor.isServer) {
|
|||
});
|
||||
} else {
|
||||
user =
|
||||
Users.findOne(username) ||
|
||||
Users.findOne({
|
||||
username,
|
||||
});
|
||||
ReactiveCache.getUser(username) ||
|
||||
ReactiveCache.getUser({ username });
|
||||
}
|
||||
if (user) {
|
||||
if (user._id === inviter._id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue