mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Move every Boards.findOne(idOrFirstObjectSelector, options) to the ReactiveCache
This commit is contained in:
parent
06e374f0ff
commit
2c92524cf4
6 changed files with 15 additions and 13 deletions
|
|
@ -619,7 +619,7 @@ function draggableMembersLabelsWidgets() {
|
||||||
const currentBoardId = Tracker.nonreactive(() => {
|
const currentBoardId = Tracker.nonreactive(() => {
|
||||||
return Session.get('currentBoard');
|
return Session.get('currentBoard');
|
||||||
});
|
});
|
||||||
Boards.findOne(currentBoardId, {
|
ReactiveCache.getBoard(currentBoardId, {
|
||||||
fields: {
|
fields: {
|
||||||
members: 1,
|
members: 1,
|
||||||
labels: 1,
|
labels: 1,
|
||||||
|
|
|
||||||
|
|
@ -1689,7 +1689,7 @@ if (Meteor.isServer) {
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
getBackgroundImageURL(boardId) {
|
getBackgroundImageURL(boardId) {
|
||||||
check(boardId, String);
|
check(boardId, String);
|
||||||
return Boards.findOne({ boardId: boardId }, {}, { backgroundImageUrl: 1 });
|
return ReactiveCache.getBoard(boardId, {}, { backgroundImageUrl: 1 });
|
||||||
},
|
},
|
||||||
quitBoard(boardId) {
|
quitBoard(boardId) {
|
||||||
check(boardId, String);
|
check(boardId, String);
|
||||||
|
|
@ -1781,7 +1781,7 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
// Insert new board at last position in sort order.
|
// Insert new board at last position in sort order.
|
||||||
Boards.before.insert((userId, doc) => {
|
Boards.before.insert((userId, doc) => {
|
||||||
const lastBoard = Boards.findOne(
|
const lastBoard = ReactiveCache.getBoard(
|
||||||
{ sort: { $exists: true } },
|
{ sort: { $exists: true } },
|
||||||
{ sort: { sort: -1 } },
|
{ sort: { sort: -1 } },
|
||||||
);
|
);
|
||||||
|
|
@ -2061,7 +2061,7 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: Boards.findOne({ _id: paramBoardId }),
|
data: ReactiveCache.getBoard(paramBoardId),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
@ -2178,7 +2178,7 @@ if (Meteor.isServer) {
|
||||||
Authentication.checkBoardAccess(req.userId, id);
|
Authentication.checkBoardAccess(req.userId, id);
|
||||||
try {
|
try {
|
||||||
if (req.body.hasOwnProperty('label')) {
|
if (req.body.hasOwnProperty('label')) {
|
||||||
const board = Boards.findOne({ _id: id });
|
const board = ReactiveCache.getBoard(id);
|
||||||
const color = req.body.label.color;
|
const color = req.body.label.color;
|
||||||
const name = req.body.label.name;
|
const name = req.body.label.name;
|
||||||
const labelId = Random.id(6);
|
const labelId = Random.id(6);
|
||||||
|
|
@ -2225,7 +2225,7 @@ if (Meteor.isServer) {
|
||||||
const boardId = req.params.boardId;
|
const boardId = req.params.boardId;
|
||||||
const memberId = req.params.memberId;
|
const memberId = req.params.memberId;
|
||||||
const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
|
const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
|
||||||
const board = Boards.findOne({ _id: boardId });
|
const board = ReactiveCache.getBoard(boardId);
|
||||||
function isTrue(data) {
|
function isTrue(data) {
|
||||||
try {
|
try {
|
||||||
return data.toLowerCase() === 'true';
|
return data.toLowerCase() === 'true';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
// exporter maybe is broken since Gridfs introduced, add fs and path
|
// exporter maybe is broken since Gridfs introduced, add fs and path
|
||||||
import { createWorkbook } from './createWorkbook';
|
import { createWorkbook } from './createWorkbook';
|
||||||
|
|
||||||
|
|
@ -33,7 +34,7 @@ class ExporterCardPDF {
|
||||||
};
|
};
|
||||||
_.extend(
|
_.extend(
|
||||||
result,
|
result,
|
||||||
Boards.findOne(this._boardId, {
|
ReactiveCache.getBoard(this._boardId, {
|
||||||
fields: {
|
fields: {
|
||||||
stars: 0,
|
stars: 0,
|
||||||
},
|
},
|
||||||
|
|
@ -621,7 +622,7 @@ class ExporterCardPDF {
|
||||||
}
|
}
|
||||||
|
|
||||||
canExport(user) {
|
canExport(user) {
|
||||||
const board = Boards.findOne(this._boardId);
|
const board = ReactiveCache.getBoard(this._boardId);
|
||||||
return board && board.isVisibleBy(user);
|
return board && board.isVisibleBy(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
import moment from 'moment/min/moment-with-locales';
|
import moment from 'moment/min/moment-with-locales';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
import { createWorkbook } from './createWorkbook';
|
import { createWorkbook } from './createWorkbook';
|
||||||
|
|
@ -35,7 +36,7 @@ class ExporterExcel {
|
||||||
};
|
};
|
||||||
_.extend(
|
_.extend(
|
||||||
result,
|
result,
|
||||||
Boards.findOne(this._boardId, {
|
ReactiveCache.getBoard(this._boardId, {
|
||||||
fields: {
|
fields: {
|
||||||
stars: 0,
|
stars: 0,
|
||||||
},
|
},
|
||||||
|
|
@ -886,7 +887,7 @@ class ExporterExcel {
|
||||||
}
|
}
|
||||||
|
|
||||||
canExport(user) {
|
canExport(user) {
|
||||||
const board = Boards.findOne(this._boardId);
|
const board = ReactiveCache.getBoard(this._boardId);
|
||||||
return board && board.isVisibleBy(user);
|
return board && board.isVisibleBy(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -899,7 +899,7 @@ Users.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
getTemplatesBoardSlug() {
|
getTemplatesBoardSlug() {
|
||||||
//return (Boards.findOne((this.profile || {}).templatesBoardId) || {}).slug;
|
//return (ReactiveCache.getBoard((this.profile || {}).templatesBoardId) || {}).slug;
|
||||||
return 'templates';
|
return 'templates';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ if (isSandstorm && Meteor.isServer) {
|
||||||
isWorker,
|
isWorker,
|
||||||
};
|
};
|
||||||
|
|
||||||
const boardMembers = Boards.findOne(sandstormBoard._id).members;
|
const boardMembers = ReactiveCache.getBoard(sandstormBoard._id).members;
|
||||||
const memberIndex = _.pluck(boardMembers, 'userId').indexOf(userId);
|
const memberIndex = _.pluck(boardMembers, 'userId').indexOf(userId);
|
||||||
|
|
||||||
let modifier;
|
let modifier;
|
||||||
|
|
@ -288,7 +288,7 @@ if (isSandstorm && Meteor.isServer) {
|
||||||
// called, the user is inserted into the database but not connected. So
|
// called, the user is inserted into the database but not connected. So
|
||||||
// despite the appearances `userId` is null in this block.
|
// despite the appearances `userId` is null in this block.
|
||||||
Users.after.insert((userId, doc) => {
|
Users.after.insert((userId, doc) => {
|
||||||
if (!Boards.findOne(sandstormBoard._id)) {
|
if (!ReactiveCache.getBoard(sandstormBoard._id)) {
|
||||||
Boards.insert(sandstormBoard, { validate: false });
|
Boards.insert(sandstormBoard, { validate: false });
|
||||||
Swimlanes.insert({
|
Swimlanes.insert({
|
||||||
title: 'Default',
|
title: 'Default',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue