mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Move every Cards.findOne(idOrFirstObjectSelector, options) to the ReactiveCache
This commit is contained in:
parent
48ba81eb3d
commit
06e374f0ff
6 changed files with 11 additions and 11 deletions
|
@ -566,7 +566,7 @@ BlazeComponent.extendComponent({
|
||||||
const impBoardId = $('.js-select-boards option:selected').val();
|
const impBoardId = $('.js-select-boards option:selected').val();
|
||||||
if (
|
if (
|
||||||
!impBoardId ||
|
!impBoardId ||
|
||||||
Cards.findOne({ linkedId: impBoardId, archived: false })
|
ReactiveCache.getCard({ linkedId: impBoardId, archived: false })
|
||||||
) {
|
) {
|
||||||
Popup.back();
|
Popup.back();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -552,9 +552,9 @@ ReactiveCache = {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
getCard(idOrFirstObjectSelector, options) {
|
getCard(idOrFirstObjectSelector, options, noCache = false) {
|
||||||
let ret;
|
let ret;
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer || noCache === true) {
|
||||||
ret = ReactiveCacheServer.getCard(idOrFirstObjectSelector, options);
|
ret = ReactiveCacheServer.getCard(idOrFirstObjectSelector, options);
|
||||||
} else {
|
} else {
|
||||||
ret = ReactiveCacheClient.getCard(idOrFirstObjectSelector, options);
|
ret = ReactiveCacheClient.getCard(idOrFirstObjectSelector, options);
|
||||||
|
|
|
@ -805,7 +805,7 @@ Boards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
hasOvertimeCards() {
|
hasOvertimeCards() {
|
||||||
const card = Cards.findOne({
|
const card = ReactiveCache.getCard({
|
||||||
isOvertime: true,
|
isOvertime: true,
|
||||||
boardId: this._id,
|
boardId: this._id,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
@ -814,7 +814,7 @@ Boards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
hasSpentTimeCards() {
|
hasSpentTimeCards() {
|
||||||
const card = Cards.findOne({
|
const card = ReactiveCache.getCard({
|
||||||
spentTime: { $gt: 0 },
|
spentTime: { $gt: 0 },
|
||||||
boardId: this._id,
|
boardId: this._id,
|
||||||
archived: false,
|
archived: false,
|
||||||
|
|
|
@ -727,7 +727,7 @@ Cards.helpers({
|
||||||
archived: false,
|
archived: false,
|
||||||
};
|
};
|
||||||
const sorting = top ? 1 : -1;
|
const sorting = top ? 1 : -1;
|
||||||
const card = Cards.findOne(selector, { sort: { sort: sorting } });
|
const card = ReactiveCache.getCard(selector, { sort: { sort: sorting } }, true);
|
||||||
let ret = null
|
let ret = null
|
||||||
if (card) {
|
if (card) {
|
||||||
ret = card.sort;
|
ret = card.sort;
|
||||||
|
@ -3287,7 +3287,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: Cards.findOne({
|
data: ReactiveCache.getCard({
|
||||||
_id: paramCardId,
|
_id: paramCardId,
|
||||||
listId: paramListId,
|
listId: paramListId,
|
||||||
boardId: paramBoardId,
|
boardId: paramBoardId,
|
||||||
|
@ -3937,7 +3937,7 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function(
|
||||||
const paramCustomFieldId = req.params.customFieldId;
|
const paramCustomFieldId = req.params.customFieldId;
|
||||||
const paramCustomFieldValue = req.body.value;
|
const paramCustomFieldValue = req.body.value;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||||
const card = Cards.findOne({
|
const card = ReactiveCache.getCard({
|
||||||
_id: paramCardId,
|
_id: paramCardId,
|
||||||
listId: paramListId,
|
listId: paramListId,
|
||||||
boardId: paramBoardId,
|
boardId: paramBoardId,
|
||||||
|
|
|
@ -696,7 +696,7 @@ export const moveToStorage = function(fileObj, storageDestination, fileStoreStra
|
||||||
};
|
};
|
||||||
|
|
||||||
export const copyFile = function(fileObj, newCardId, fileStoreStrategyFactory) {
|
export const copyFile = function(fileObj, newCardId, fileStoreStrategyFactory) {
|
||||||
const newCard = Cards.findOne(newCardId);
|
const newCard = ReactiveCache.getCard(newCardId);
|
||||||
Object.keys(fileObj.versions).forEach(versionName => {
|
Object.keys(fileObj.versions).forEach(versionName => {
|
||||||
const strategyRead = fileStoreStrategyFactory.getFileStrategy(fileObj, versionName);
|
const strategyRead = fileStoreStrategyFactory.getFileStrategy(fileObj, versionName);
|
||||||
const readStream = strategyRead.getReadStream();
|
const readStream = strategyRead.getReadStream();
|
||||||
|
|
|
@ -299,11 +299,11 @@ Lists.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
absoluteUrl() {
|
absoluteUrl() {
|
||||||
const card = Cards.findOne({ listId: this._id });
|
const card = ReactiveCache.getCard({ listId: this._id });
|
||||||
return card && card.absoluteUrl();
|
return card && card.absoluteUrl();
|
||||||
},
|
},
|
||||||
originRelativeUrl() {
|
originRelativeUrl() {
|
||||||
const card = Cards.findOne({ listId: this._id });
|
const card = ReactiveCache.getCard({ listId: this._id });
|
||||||
return card && card.originRelativeUrl();
|
return card && card.originRelativeUrl();
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue