mirror of
https://github.com/wekan/wekan.git
synced 2026-02-05 08:01: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
|
|
@ -1646,7 +1646,7 @@ Template.cardAssigneesPopup.helpers({
|
|||
|
||||
Template.cardAssigneePopup.helpers({
|
||||
userData() {
|
||||
return Users.findOne(this.userId, {
|
||||
return ReactiveCache.getUser(this.userId, {
|
||||
fields: {
|
||||
profile: 1,
|
||||
username: 1,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
export function csvGetMembersToMap(data) {
|
||||
// we will work on the list itself (an ordered array of objects) when a
|
||||
// mapping is done, we add a 'wekan' field to the object representing the
|
||||
|
|
@ -28,7 +30,7 @@ export function csvGetMembersToMap(data) {
|
|||
username: importedMember,
|
||||
id: importedMember,
|
||||
};
|
||||
const wekanUser = Users.findOne({ username: importedMember.username });
|
||||
const wekanUser = ReactiveCache.getUser({ username: importedMember.username });
|
||||
if (wekanUser) importedMember.wekanId = wekanUser._id;
|
||||
membersToMap.push(importedMember);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { trelloGetMembersToMap } from './trelloMembersMapper';
|
||||
import { wekanGetMembersToMap } from './wekanMembersMapper';
|
||||
import { csvGetMembersToMap } from './csvMembersMapper';
|
||||
|
|
@ -174,9 +175,9 @@ BlazeComponent.extendComponent({
|
|||
this._refreshMembers(
|
||||
this.members().map(member => {
|
||||
if (!member.wekanId) {
|
||||
let user = Users.findOne({ username: member.username });
|
||||
let user = ReactiveCache.getUser({ username: member.username });
|
||||
if (!user) {
|
||||
user = Users.findOne({ importUsernames: member.username });
|
||||
user = ReactiveCache.getUser({ importUsernames: member.username });
|
||||
}
|
||||
if (user) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
export function trelloGetMembersToMap(data) {
|
||||
// we will work on the list itself (an ordered array of objects) when a
|
||||
// mapping is done, we add a 'wekan' field to the object representing the
|
||||
|
|
@ -5,7 +7,7 @@ export function trelloGetMembersToMap(data) {
|
|||
const membersToMap = data.members;
|
||||
// auto-map based on username
|
||||
membersToMap.forEach(importedMember => {
|
||||
const wekanUser = Users.findOne({ username: importedMember.username });
|
||||
const wekanUser = ReactiveCache.getUser({ username: importedMember.username });
|
||||
if (wekanUser) {
|
||||
importedMember.wekanId = wekanUser._id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
export function wekanGetMembersToMap(data) {
|
||||
// we will work on the list itself (an ordered array of objects) when a
|
||||
// mapping is done, we add a 'wekan' field to the object representing the
|
||||
|
|
@ -15,7 +17,7 @@ export function wekanGetMembersToMap(data) {
|
|||
importedMember.fullName = user.profile.fullname;
|
||||
}
|
||||
importedMember.username = user.username;
|
||||
const wekanUser = Users.findOne({ username: importedMember.username });
|
||||
const wekanUser = ReactiveCache.getUser({ username: importedMember.username });
|
||||
if (wekanUser) {
|
||||
importedMember.wekanId = wekanUser._id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.rulesCurrentTab = new ReactiveVar('rulesList');
|
||||
|
|
@ -55,7 +57,7 @@ BlazeComponent.extendComponent({
|
|||
let trigger = this.triggerVar.get();
|
||||
trigger.userId = '*';
|
||||
if (username !== undefined) {
|
||||
const userFound = Users.findOne({ username });
|
||||
const userFound = ReactiveCache.getUser({ username });
|
||||
if (userFound !== undefined) {
|
||||
trigger.userId = userFound._id;
|
||||
this.triggerVar.set(trigger);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue