From 9022e9949f73eadad51be7f4d433c0daaa561b9b Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Thu, 15 Dec 2022 22:26:08 +0100 Subject: [PATCH] Move every Boards.findOne(Session.get('currentBoard')) to the ReactiveCache --- client/components/boards/boardArchive.js | 8 +-- client/components/boards/boardBody.js | 10 ++-- client/components/boards/boardHeader.js | 14 ++--- client/components/cards/attachments.js | 6 +-- client/components/cards/cardDetails.js | 6 +-- client/components/cards/labels.js | 8 +-- client/components/lists/list.js | 2 +- client/components/lists/listBody.js | 4 +- client/components/main/editor.js | 4 +- .../components/rules/actions/cardActions.js | 2 +- .../components/rules/triggers/cardTriggers.js | 2 +- client/components/sidebar/sidebar.js | 52 +++++++++---------- client/components/sidebar/sidebarArchives.js | 2 +- client/components/sidebar/sidebarSearches.js | 4 +- client/components/swimlanes/swimlaneHeader.js | 2 +- client/components/swimlanes/swimlanes.js | 6 +-- client/lib/utils.js | 4 +- config/router.js | 2 +- 18 files changed, 69 insertions(+), 69 deletions(-) diff --git a/client/components/boards/boardArchive.js b/client/components/boards/boardArchive.js index ca80a694b..aa1ee7eda 100644 --- a/client/components/boards/boardArchive.js +++ b/client/components/boards/boardArchive.js @@ -25,8 +25,8 @@ BlazeComponent.extendComponent({ Meteor.settings && Meteor.settings.public && Meteor.settings.public.sandstorm; - if (isSandstorm && Session.get('currentBoard')) { - const currentBoard = Boards.findOne(Session.get('currentBoard')); + if (isSandstorm && Utils.getCurrentBoardId()) { + const currentBoard = Utils.getCurrentBoard(); currentBoard.archive(); } const board = this.currentData(); @@ -39,8 +39,8 @@ BlazeComponent.extendComponent({ Meteor.settings && Meteor.settings.public && Meteor.settings.public.sandstorm; - if (isSandstorm && Session.get('currentBoard')) { - const currentBoard = Boards.findOne(Session.get('currentBoard')); + if (isSandstorm && Utils.getCurrentBoardId()) { + const currentBoard = Utils.getCurrentBoard(); Boards.remove(currentBoard._id); } Boards.remove(this._id); diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 2ed40bbe7..658c5e235 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -43,7 +43,7 @@ BlazeComponent.extendComponent({ this.mouseHasEnterCardDetails = false; // fix swimlanes sort field if there are null values - const currentBoardData = Boards.findOne(Session.get('currentBoard')); + const currentBoardData = Utils.getCurrentBoard(); const nullSortSwimlanes = currentBoardData.nullSortSwimlanes(); if (nullSortSwimlanes.count() > 0) { const swimlanes = currentBoardData.swimlanes(); @@ -214,7 +214,7 @@ BlazeComponent.extendComponent({ // If there is no data in the board (ie, no lists) we autofocus the list // creation form by clicking on the corresponding element. - const currentBoard = Boards.findOne(Session.get('currentBoard')); + const currentBoard = Utils.getCurrentBoard(); if (Utils.canModifyBoard() && currentBoard.lists().count() === 0) { boardComponent.openNewListForm(); } @@ -222,7 +222,7 @@ BlazeComponent.extendComponent({ notDisplayThisBoard() { let allowPrivateVisibilityOnly = TableVisibilityModeSettings.findOne('tableVisibilityMode-allowPrivateOnly'); - let currentBoard = Boards.findOne(Session.get('currentBoard')); + let currentBoard = Utils.getCurrentBoard(); if (allowPrivateVisibilityOnly !== undefined && allowPrivateVisibilityOnly.booleanValue && currentBoard.permission == 'public') { return true; } @@ -342,7 +342,7 @@ BlazeComponent.extendComponent({ }, locale: TAPi18n.getLanguage(), events(start, end, timezone, callback) { - const currentBoard = Boards.findOne(Session.get('currentBoard')); + const currentBoard = Utils.getCurrentBoard(); const events = []; const pushEvent = function (card, title, start, end, extraCls) { start = start || card.startAt; @@ -416,7 +416,7 @@ BlazeComponent.extendComponent({ } }, select: function(startDate) { - const currentBoard = Boards.findOne(Session.get('currentBoard')); + const currentBoard = Utils.getCurrentBoard(); const currentUser = Meteor.user(); const $modal = $(`