mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Move every Lists.findOne(idOrFirstObjectSelector, options) to the ReactiveCache
This commit is contained in:
parent
ad9daba60d
commit
9e557f6887
7 changed files with 12 additions and 12 deletions
|
|
@ -251,7 +251,7 @@ BlazeComponent.extendComponent({
|
||||||
if (lastList) {
|
if (lastList) {
|
||||||
const positionInput = this.find('.list-position-input');
|
const positionInput = this.find('.list-position-input');
|
||||||
const position = positionInput.value.trim();
|
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 = parseInt(JSON.stringify(ret['sort']))
|
||||||
sortIndex = sortIndex+1
|
sortIndex = sortIndex+1
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
|
||||||
if (!this.selectedSwimlaneId.get() || !ReactiveCache.getSwimlane({_id: this.selectedSwimlaneId.get(), boardId: this.selectedBoardId.get()})) {
|
if (!this.selectedSwimlaneId.get() || !ReactiveCache.getSwimlane({_id: this.selectedSwimlaneId.get(), boardId: this.selectedBoardId.get()})) {
|
||||||
this.setFirstSwimlaneId();
|
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();
|
this.setFirstListId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -763,7 +763,7 @@ Boards.helpers({
|
||||||
* @returns Document the last list
|
* @returns Document the last list
|
||||||
*/
|
*/
|
||||||
getLastList() {
|
getLastList() {
|
||||||
const ret = Lists.findOne({ boardId: this._id }, { sort: { sort: 'desc' } });
|
const ret = ReactiveCache.getList({ boardId: this._id }, { sort: { sort: 'desc' } });
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ Lists.helpers({
|
||||||
this.swimlaneId = swimlaneId;
|
this.swimlaneId = swimlaneId;
|
||||||
|
|
||||||
let _id = null;
|
let _id = null;
|
||||||
const existingListWithSameName = Lists.findOne({
|
const existingListWithSameName = ReactiveCache.getList({
|
||||||
boardId,
|
boardId,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
@ -219,7 +219,7 @@ Lists.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
move(boardId, swimlaneId) {
|
move(boardId, swimlaneId) {
|
||||||
const boardList = Lists.findOne({
|
const boardList = ReactiveCache.getList({
|
||||||
boardId,
|
boardId,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
@ -534,7 +534,7 @@ if (Meteor.isServer) {
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Lists.findOne({
|
data: ReactiveCache.getList({
|
||||||
_id: paramListId,
|
_id: paramListId,
|
||||||
boardId: paramBoardId,
|
boardId: paramBoardId,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ Swimlanes.helpers({
|
||||||
|
|
||||||
move(toBoardId) {
|
move(toBoardId) {
|
||||||
this.lists().forEach(list => {
|
this.lists().forEach(list => {
|
||||||
const toList = Lists.findOne({
|
const toList = ReactiveCache.getList({
|
||||||
boardId: toBoardId,
|
boardId: toBoardId,
|
||||||
title: list.title,
|
title: list.title,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ Triggers.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
findList(title) {
|
findList(title) {
|
||||||
return Lists.findOne({
|
return ReactiveCache.getList({
|
||||||
title,
|
title,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,10 @@ RulesHelper = {
|
||||||
if (action.listName === '*') {
|
if (action.listName === '*') {
|
||||||
list = card.list();
|
list = card.list();
|
||||||
if (boardId !== action.boardId) {
|
if (boardId !== action.boardId) {
|
||||||
list = Lists.findOne({ title: list.title, boardId: action.boardId });
|
list = ReactiveCache.getList({ title: list.title, boardId: action.boardId });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list = Lists.findOne({
|
list = ReactiveCache.getList({
|
||||||
title: action.listName,
|
title: action.listName,
|
||||||
boardId: action.boardId,
|
boardId: action.boardId,
|
||||||
});
|
});
|
||||||
|
|
@ -349,7 +349,7 @@ RulesHelper = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (action.actionType === 'createCard') {
|
if (action.actionType === 'createCard') {
|
||||||
const list = Lists.findOne({ title: action.listName, boardId });
|
const list = ReactiveCache.getList({ title: action.listName, boardId });
|
||||||
let listId = '';
|
let listId = '';
|
||||||
let swimlaneId = '';
|
let swimlaneId = '';
|
||||||
const swimlane = ReactiveCache.getSwimlane({
|
const swimlane = ReactiveCache.getSwimlane({
|
||||||
|
|
@ -375,7 +375,7 @@ RulesHelper = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (action.actionType === 'linkCard') {
|
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);
|
const card = ReactiveCache.getCard(activity.cardId);
|
||||||
let listId = '';
|
let listId = '';
|
||||||
let swimlaneId = '';
|
let swimlaneId = '';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue