Move every Swimlanes.findOne() to the ReactiveCache

This commit is contained in:
Martin Filser 2023-01-15 00:07:17 +01:00
parent 2f2aa7b08a
commit bf48d4371c
6 changed files with 11 additions and 12 deletions

View file

@ -65,7 +65,7 @@ BlazeComponent.extendComponent({
swimlaneId = this.parentComponent() swimlaneId = this.parentComponent()
.parentComponent() .parentComponent()
.data()._id; // Always swimlanes view .data()._id; // Always swimlanes view
const swimlane = Swimlanes.findOne(swimlaneId); const swimlane = ReactiveCache.getSwimlane(swimlaneId);
// If this is the card templates swimlane, insert a card template // If this is the card templates swimlane, insert a card template
if (swimlane.isCardTemplatesSwimlane()) cardType = 'template-card'; if (swimlane.isCardTemplatesSwimlane()) cardType = 'template-card';
// If this is the board templates swimlane, insert a board template and a linked card // If this is the board templates swimlane, insert a board template and a linked card
@ -739,7 +739,7 @@ BlazeComponent.extendComponent({
Filter.addException(_id); Filter.addException(_id);
// List insertion // List insertion
} else if (this.isListTemplateSearch) { } else if (this.isListTemplateSearch) {
element.sort = Swimlanes.findOne(this.swimlaneId) element.sort = ReactiveCache.getSwimlane(this.swimlaneId)
.lists() .lists()
.count(); .count();
element.type = 'list'; element.type = 'list';

View file

@ -370,7 +370,6 @@ class MoveSwimlaneComponent extends BlazeComponent {
return [ return [
{ {
'click .js-done'() { 'click .js-done'() {
// const swimlane = Swimlanes.findOne(this.currentSwimlane._id);
const bSelect = $('.js-select-boards')[0]; const bSelect = $('.js-select-boards')[0];
let boardId; let boardId;
if (bSelect) { if (bSelect) {

View file

@ -29,10 +29,10 @@ Activities.helpers({
return ReactiveCache.getList(this.listId); return ReactiveCache.getList(this.listId);
}, },
swimlane() { swimlane() {
return Swimlanes.findOne(this.swimlaneId); return ReactiveCache.getSwimlane(this.swimlaneId);
}, },
oldSwimlane() { oldSwimlane() {
return Swimlanes.findOne(this.oldSwimlaneId); return ReactiveCache.getSwimlane(this.oldSwimlaneId);
}, },
oldList() { oldList() {
return ReactiveCache.getList(this.oldListId); return ReactiveCache.getList(this.oldListId);

View file

@ -2688,7 +2688,7 @@ function cardMove(
oldBoardId, oldBoardId,
oldBoardName: ReactiveCache.getBoard(oldBoardId).title, oldBoardName: ReactiveCache.getBoard(oldBoardId).title,
cardId: doc._id, cardId: doc._id,
swimlaneName: Swimlanes.findOne(doc.swimlaneId).title, swimlaneName: ReactiveCache.getSwimlane(doc.swimlaneId).title,
swimlaneId: doc.swimlaneId, swimlaneId: doc.swimlaneId,
oldSwimlaneId, oldSwimlaneId,
}); });
@ -2705,7 +2705,7 @@ function cardMove(
boardId: doc.boardId, boardId: doc.boardId,
cardId: doc._id, cardId: doc._id,
cardTitle: doc.title, cardTitle: doc.title,
swimlaneName: Swimlanes.findOne(doc.swimlaneId).title, swimlaneName: ReactiveCache.getSwimlane(doc.swimlaneId).title,
swimlaneId: doc.swimlaneId, swimlaneId: doc.swimlaneId,
oldSwimlaneId, oldSwimlaneId,
}); });
@ -2917,7 +2917,7 @@ function cardCreation(userId, doc) {
listId: doc.listId, listId: doc.listId,
cardId: doc._id, cardId: doc._id,
cardTitle: doc.title, cardTitle: doc.title,
swimlaneName: Swimlanes.findOne(doc.swimlaneId).title, swimlaneName: ReactiveCache.getSwimlane(doc.swimlaneId).title,
swimlaneId: doc.swimlaneId, swimlaneId: doc.swimlaneId,
}); });
} }

View file

@ -5,7 +5,7 @@ Meteor.methods({
check(swimlaneId, String); check(swimlaneId, String);
check(toBoardId, String); check(toBoardId, String);
const swimlane = Swimlanes.findOne(swimlaneId); const swimlane = ReactiveCache.getSwimlane(swimlaneId);
const toBoard = ReactiveCache.getBoard(toBoardId); const toBoard = ReactiveCache.getBoard(toBoardId);
if (swimlane && toBoard) { if (swimlane && toBoard) {
@ -20,7 +20,7 @@ Meteor.methods({
check(swimlaneId, String); check(swimlaneId, String);
check(toBoardId, String); check(toBoardId, String);
const swimlane = Swimlanes.findOne(swimlaneId); const swimlane = ReactiveCache.getSwimlane(swimlaneId);
const toBoard = ReactiveCache.getBoard(toBoardId); const toBoard = ReactiveCache.getBoard(toBoardId);
if (swimlane && toBoard) { if (swimlane && toBoard) {

View file

@ -42,7 +42,7 @@ RulesHelper = {
value = oldList.title; value = oldList.title;
} }
} else if (field === 'oldSwimlaneName') { } else if (field === 'oldSwimlaneName') {
const oldSwimlane = Swimlanes.findOne({ _id: activity.oldSwimlaneId }); const oldSwimlane = ReactiveCache.getSwimlane(activity.oldSwimlaneId);
if (oldSwimlane) { if (oldSwimlane) {
value = oldSwimlane.title; value = oldSwimlane.title;
} }
@ -86,7 +86,7 @@ RulesHelper = {
let swimlane; let swimlane;
let swimlaneId; let swimlaneId;
if (action.swimlaneName === '*') { if (action.swimlaneName === '*') {
swimlane = Swimlanes.findOne(card.swimlaneId); swimlane = ReactiveCache.getSwimlane(card.swimlaneId);
if (boardId !== action.boardId) { if (boardId !== action.boardId) {
swimlane = Swimlanes.findOne({ swimlane = Swimlanes.findOne({
title: swimlane.title, title: swimlane.title,