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

pull/5014/head
Martin Filser 2 years ago
parent 76aae41637
commit 10a9306abd
  1. 3
      client/components/boards/boardArchive.js
  2. 7
      client/components/boards/boardsList.js
  3. 7
      client/components/cards/cardDetails.js
  4. 3
      client/components/cards/checklists.js
  5. 10
      client/components/lists/listBody.js
  6. 4
      client/components/rules/actions/boardActions.js
  7. 4
      client/components/settings/settingBody.js
  8. 6
      client/components/sidebar/sidebar.js
  9. 3
      client/components/swimlanes/swimlanes.js
  10. 2
      client/lib/dialogWithBoardSwimlaneList.js
  11. 2
      client/lib/utils.js

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save