Move every Lists.findOne(idOrFirstObjectSelector, options) to the ReactiveCache

This commit is contained in:
Martin Filser 2023-02-04 17:06:40 +01:00
parent ad9daba60d
commit 9e557f6887
7 changed files with 12 additions and 12 deletions

View file

@ -251,7 +251,7 @@ BlazeComponent.extendComponent({
if (lastList) {
const positionInput = this.find('.list-position-input');
const position = positionInput.value.trim();
const ret = Lists.findOne({ boardId: Utils.getCurrentBoardId(), _id: position, archived: false })
const ret = ReactiveCache.getList({ boardId: Utils.getCurrentBoardId(), _id: position, archived: false })
sortIndex = parseInt(JSON.stringify(ret['sort']))
sortIndex = sortIndex+1
} else {

View file

@ -57,7 +57,7 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
if (!this.selectedSwimlaneId.get() || !ReactiveCache.getSwimlane({_id: this.selectedSwimlaneId.get(), boardId: this.selectedBoardId.get()})) {
this.setFirstSwimlaneId();
}
if (!this.selectedListId.get() || !Lists.findOne({_id: this.selectedListId.get(), boardId: this.selectedBoardId.get()})) {
if (!this.selectedListId.get() || !ReactiveCache.getList({_id: this.selectedListId.get(), boardId: this.selectedBoardId.get()})) {
this.setFirstListId();
}
}

View file

@ -763,7 +763,7 @@ Boards.helpers({
* @returns Document the last list
*/
getLastList() {
const ret = Lists.findOne({ boardId: this._id }, { sort: { sort: 'desc' } });
const ret = ReactiveCache.getList({ boardId: this._id }, { sort: { sort: 'desc' } });
return ret;
},

View file

@ -195,7 +195,7 @@ Lists.helpers({
this.swimlaneId = swimlaneId;
let _id = null;
const existingListWithSameName = Lists.findOne({
const existingListWithSameName = ReactiveCache.getList({
boardId,
title: this.title,
archived: false,
@ -219,7 +219,7 @@ Lists.helpers({
},
move(boardId, swimlaneId) {
const boardList = Lists.findOne({
const boardList = ReactiveCache.getList({
boardId,
title: this.title,
archived: false,
@ -534,7 +534,7 @@ if (Meteor.isServer) {
Authentication.checkBoardAccess(req.userId, paramBoardId);
JsonRoutes.sendResult(res, {
code: 200,
data: Lists.findOne({
data: ReactiveCache.getList({
_id: paramListId,
boardId: paramBoardId,
archived: false,

View file

@ -150,7 +150,7 @@ Swimlanes.helpers({
move(toBoardId) {
this.lists().forEach(list => {
const toList = Lists.findOne({
const toList = ReactiveCache.getList({
boardId: toBoardId,
title: list.title,
archived: false,

View file

@ -55,7 +55,7 @@ Triggers.helpers({
},
findList(title) {
return Lists.findOne({
return ReactiveCache.getList({
title,
});
},

View file

@ -69,10 +69,10 @@ RulesHelper = {
if (action.listName === '*') {
list = card.list();
if (boardId !== action.boardId) {
list = Lists.findOne({ title: list.title, boardId: action.boardId });
list = ReactiveCache.getList({ title: list.title, boardId: action.boardId });
}
} else {
list = Lists.findOne({
list = ReactiveCache.getList({
title: action.listName,
boardId: action.boardId,
});
@ -349,7 +349,7 @@ RulesHelper = {
}
}
if (action.actionType === 'createCard') {
const list = Lists.findOne({ title: action.listName, boardId });
const list = ReactiveCache.getList({ title: action.listName, boardId });
let listId = '';
let swimlaneId = '';
const swimlane = ReactiveCache.getSwimlane({
@ -375,7 +375,7 @@ RulesHelper = {
});
}
if (action.actionType === 'linkCard') {
const list = Lists.findOne({ title: action.listName, boardId: action.boardId });
const list = ReactiveCache.getList({ title: action.listName, boardId: action.boardId });
const card = ReactiveCache.getCard(activity.cardId);
let listId = '';
let swimlaneId = '';