mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Move every Users.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)
This commit is contained in:
parent
46840c9373
commit
6646b8638e
5 changed files with 23 additions and 15 deletions
|
@ -141,7 +141,7 @@ Meteor.publish('boardsReport', function() {
|
|||
|
||||
const ret = [
|
||||
boards,
|
||||
Users.find({ _id: { $in: userIds } }, { fields: Users.safeFields }),
|
||||
ReactiveCache.getUsers({ _id: { $in: userIds } }, { fields: Users.safeFields }, true),
|
||||
Team.find({ _id: { $in: teamIds } }),
|
||||
Org.find({ _id: { $in: orgIds } }),
|
||||
]
|
||||
|
@ -326,7 +326,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
|
|||
// and sending it triggers a subtle bug:
|
||||
// https://github.com/wefork/wekan/issues/15
|
||||
this.cursor(
|
||||
Users.find(
|
||||
ReactiveCache.getUsers(
|
||||
{
|
||||
_id: { $in: _.without(memberIds, thisUserId) },
|
||||
},
|
||||
|
@ -338,6 +338,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
|
|||
'profile.initials': 1,
|
||||
},
|
||||
},
|
||||
true,
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -790,7 +790,7 @@ function findCards(sessionId, query) {
|
|||
),
|
||||
ReactiveCache.getLists({ _id: { $in: lists } }, { fields }, true),
|
||||
CustomFields.find({ _id: { $in: customFieldIds } }),
|
||||
Users.find({ _id: { $in: users } }, { fields: Users.safeFields }),
|
||||
ReactiveCache.getUsers({ _id: { $in: users } }, { fields: Users.safeFields }, true),
|
||||
Checklists.find({ cardId: { $in: cards.map(c => c._id) } }),
|
||||
ChecklistItems.find({ cardId: { $in: cards.map(c => c._id) } }),
|
||||
Attachments.find({ 'meta.cardId': { $in: cards.map(c => c._id) } }).cursor,
|
||||
|
|
|
@ -106,13 +106,17 @@ Meteor.publish('notificationSwimlanes', function() {
|
|||
|
||||
// gets all users associated with activities associated with the current user
|
||||
Meteor.publish('notificationUsers', function() {
|
||||
const ret = Users.find({
|
||||
_id: {
|
||||
$in: activities()
|
||||
.map(v => v.userId)
|
||||
.filter(v => !!v),
|
||||
const ret = ReactiveCache.getUsers(
|
||||
{
|
||||
_id: {
|
||||
$in: activities()
|
||||
.map(v => v.userId)
|
||||
.filter(v => !!v),
|
||||
},
|
||||
},
|
||||
});
|
||||
{},
|
||||
true,
|
||||
);
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ Meteor.publish('people', function(query, limit) {
|
|||
const user = ReactiveCache.getCurrentUser();
|
||||
|
||||
if (user && user.isAdmin) {
|
||||
ret = Users.find(query, {
|
||||
ret = ReactiveCache.getUsers(query, {
|
||||
limit,
|
||||
sort: { createdAt: -1 },
|
||||
fields: {
|
||||
|
@ -24,7 +24,8 @@ Meteor.publish('people', function(query, limit) {
|
|||
orgs: 1,
|
||||
teams: 1,
|
||||
},
|
||||
});
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -3,7 +3,7 @@ Meteor.publish('user-miniprofile', function (usernames) {
|
|||
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('usernames:', usernames);
|
||||
const ret = Users.find(
|
||||
const ret = ReactiveCache.getUsers(
|
||||
{
|
||||
$or: [
|
||||
{ username: { $in: usernames } },
|
||||
|
@ -16,6 +16,7 @@ Meteor.publish('user-miniprofile', function (usernames) {
|
|||
importUsernames: 1,
|
||||
},
|
||||
},
|
||||
true,
|
||||
);
|
||||
return ret;
|
||||
});
|
||||
|
@ -34,7 +35,7 @@ Meteor.publish('user-admin', function () {
|
|||
|
||||
Meteor.publish('user-authenticationMethod', function (match) {
|
||||
check(match, String);
|
||||
const ret = Users.find(
|
||||
const ret = ReactiveCache.getUsers(
|
||||
{ $or: [{ _id: match }, { email: match }, { username: match }] },
|
||||
{
|
||||
fields: {
|
||||
|
@ -43,6 +44,7 @@ Meteor.publish('user-authenticationMethod', function (match) {
|
|||
orgs: 1,
|
||||
},
|
||||
},
|
||||
true,
|
||||
);
|
||||
return ret;
|
||||
});
|
||||
|
@ -100,9 +102,9 @@ I20221023-09:15:09.602(3)? at packages/ddp-server/livedata_server.js:1496:18
|
|||
// console.log('connection.Id on close...', connection.id);
|
||||
// // Get all user that were connected to this socket
|
||||
// // And update last connection date and last connection average time (in seconds) for each user
|
||||
// let lstOfUserThatWasConnectedToThisSocket = Users.find({
|
||||
// let lstOfUserThatWasConnectedToThisSocket = ReactiveCache.getUsers({
|
||||
// lastconnectedSocketId: connection.id,
|
||||
// }).fetch();
|
||||
// }, {}, true).fetch();
|
||||
// if (
|
||||
// lstOfUserThatWasConnectedToThisSocket !== undefined &&
|
||||
// lstOfUserThatWasConnectedToThisSocket.length > 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue