mirror of
https://github.com/wekan/wekan.git
synced 2025-06-27 17:00:47 -04: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();
|
||||
if (
|
||||
!impBoardId ||
|
||||
Cards.findOne({ linkedId: impBoardId, archived: false })
|
||||
ReactiveCache.getCard({ linkedId: impBoardId, archived: false })
|
||||
) {
|
||||
Popup.back();
|
||||
return;
|
||||
|
|
|
@ -552,9 +552,9 @@ ReactiveCache = {
|
|||
}
|
||||
return ret;
|
||||
},
|
||||
getCard(idOrFirstObjectSelector, options) {
|
||||
getCard(idOrFirstObjectSelector, options, noCache = false) {
|
||||
let ret;
|
||||
if (Meteor.isServer) {
|
||||
if (Meteor.isServer || noCache === true) {
|
||||
ret = ReactiveCacheServer.getCard(idOrFirstObjectSelector, options);
|
||||
} else {
|
||||
ret = ReactiveCacheClient.getCard(idOrFirstObjectSelector, options);
|
||||
|
|
|
@ -805,7 +805,7 @@ Boards.helpers({
|
|||
},
|
||||
|
||||
hasOvertimeCards() {
|
||||
const card = Cards.findOne({
|
||||
const card = ReactiveCache.getCard({
|
||||
isOvertime: true,
|
||||
boardId: this._id,
|
||||
archived: false,
|
||||
|
@ -814,7 +814,7 @@ Boards.helpers({
|
|||
},
|
||||
|
||||
hasSpentTimeCards() {
|
||||
const card = Cards.findOne({
|
||||
const card = ReactiveCache.getCard({
|
||||
spentTime: { $gt: 0 },
|
||||
boardId: this._id,
|
||||
archived: false,
|
||||
|
|
|
@ -727,7 +727,7 @@ Cards.helpers({
|
|||
archived: false,
|
||||
};
|
||||
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
|
||||
if (card) {
|
||||
ret = card.sort;
|
||||
|
@ -3287,7 +3287,7 @@ if (Meteor.isServer) {
|
|||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: Cards.findOne({
|
||||
data: ReactiveCache.getCard({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
|
@ -3937,7 +3937,7 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function(
|
|||
const paramCustomFieldId = req.params.customFieldId;
|
||||
const paramCustomFieldValue = req.body.value;
|
||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
const card = Cards.findOne({
|
||||
const card = ReactiveCache.getCard({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
|
|
|
@ -696,7 +696,7 @@ export const moveToStorage = function(fileObj, storageDestination, fileStoreStra
|
|||
};
|
||||
|
||||
export const copyFile = function(fileObj, newCardId, fileStoreStrategyFactory) {
|
||||
const newCard = Cards.findOne(newCardId);
|
||||
const newCard = ReactiveCache.getCard(newCardId);
|
||||
Object.keys(fileObj.versions).forEach(versionName => {
|
||||
const strategyRead = fileStoreStrategyFactory.getFileStrategy(fileObj, versionName);
|
||||
const readStream = strategyRead.getReadStream();
|
||||
|
|
|
@ -299,11 +299,11 @@ Lists.helpers({
|
|||
},
|
||||
|
||||
absoluteUrl() {
|
||||
const card = Cards.findOne({ listId: this._id });
|
||||
const card = ReactiveCache.getCard({ listId: this._id });
|
||||
return card && card.absoluteUrl();
|
||||
},
|
||||
originRelativeUrl() {
|
||||
const card = Cards.findOne({ listId: this._id });
|
||||
const card = ReactiveCache.getCard({ listId: this._id });
|
||||
return card && card.originRelativeUrl();
|
||||
},
|
||||
remove() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue