Move every Boards.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory client/)

This commit is contained in:
Martin Filser 2023-02-09 23:16:44 +01:00
parent 76aae41637
commit 10a9306abd
11 changed files with 29 additions and 22 deletions

View file

@ -10,12 +10,13 @@ BlazeComponent.extendComponent({
},
archivedBoards() {
return Boards.find(
const ret = ReactiveCache.getBoards(
{ archived: true },
{
sort: { archivedAt: -1, modifiedAt: -1 },
},
);
return ret;
},
events() {

View file

@ -181,9 +181,10 @@ BlazeComponent.extendComponent({
};
}
return Boards.find(query, {
const ret = ReactiveCache.getBoards(query, {
sort: { sort: 1 /* boards default sorting */ },
});
return ret;
},
boardLists(boardId) {
let boardLists = [];
@ -248,7 +249,7 @@ BlazeComponent.extendComponent({
'copyBoard',
this.currentData()._id,
{
sort: Boards.find({ archived: false }).count(),
sort: ReactiveCache.getBoards({ archived: false }).length,
type: 'board',
title: ReactiveCache.getBoard(this.currentData()._id).title,
},
@ -324,7 +325,7 @@ BlazeComponent.extendComponent({
query.$and[2].$or.push({ 'orgs.orgId': { $in: selectedOrgsValues } });
}
let filteredBoards = Boards.find(query, {}).fetch();
let filteredBoards = ReactiveCache.getBoards(query, {});
let allBoards = document.getElementsByClassName("js-board");
let currBoard;
if (filteredBoards.length > 0) {

View file

@ -961,18 +961,17 @@ BlazeComponent.extendComponent({
},
boards() {
return Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
_id: {
$ne: ReactiveCache.getCurrentUser().getTemplatesBoardId(),
},
_id: { $ne: ReactiveCache.getCurrentUser().getTemplatesBoardId() },
},
{
sort: { sort: 1 /* boards default sorting */ },
},
);
return ret;
},
cards() {

View file

@ -233,7 +233,7 @@ BlazeComponent.extendComponent({
},
boards() {
return Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -243,6 +243,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return ret;
},
swimlanes() {

View file

@ -444,7 +444,7 @@ BlazeComponent.extendComponent({
},
boards() {
const boards = Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -455,7 +455,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
return ret;
},
swimlanes() {
@ -650,7 +650,7 @@ BlazeComponent.extendComponent({
},
boards() {
const boards = Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -661,7 +661,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
return ret;
},
results() {
@ -752,7 +752,7 @@ BlazeComponent.extendComponent({
'copyBoard',
element.linkedId,
{
sort: Boards.find({ archived: false }).count(),
sort: ReactiveCache.getBoards({ archived: false }).length,
type: 'board',
title: element.title,
},

View file

@ -4,7 +4,7 @@ BlazeComponent.extendComponent({
onCreated() {},
boards() {
const boards = Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -16,7 +16,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
return ret;
},
events() {

View file

@ -1,3 +1,4 @@
import { ReactiveCache } from '/imports/reactiveCache';
import { TAPi18n } from '/imports/i18n';
import { ALLOWED_WAIT_SPINNERS } from '/config/const';
@ -43,7 +44,7 @@ BlazeComponent.extendComponent({
},
boards() {
return Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -53,6 +54,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return ret;
},
toggleForgotPassword() {
this.setLoading(true);

View file

@ -786,7 +786,7 @@ BlazeComponent.extendComponent({
},
boards() {
return Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -795,6 +795,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return ret;
},
lists() {
@ -984,7 +985,7 @@ BlazeComponent.extendComponent({
},
boards() {
return Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),
@ -993,6 +994,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 /* boards default sorting */ },
},
);
return ret;
},
lists() {

View file

@ -345,7 +345,8 @@ class MoveSwimlaneComponent extends BlazeComponent {
}
toBoards() {
return Boards.find(this.toBoardsSelector(), { sort: { title: 1 } });
const ret = ReactiveCache.getBoards(this.toBoardsSelector(), { sort: { title: 1 } });
return ret;
}
events() {

View file

@ -107,7 +107,7 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
/** returns all available board */
boards() {
const ret = Boards.find(
const ret = ReactiveCache.getBoards(
{
archived: false,
'members.userId': Meteor.userId(),

View file

@ -163,7 +163,7 @@ Utils = {
archivedBoardIds() {
const archivedBoards = [];
Boards.find({ archived: false }).forEach(board => {
ReactiveCache.getBoards({ archived: false }).forEach(board => {
archivedBoards.push(board._id);
});
return archivedBoards;