Move every Boards.findOne(Session.get('currentBoard')) to the ReactiveCache

This commit is contained in:
Martin Filser 2022-12-15 22:26:08 +01:00
parent cecf69af02
commit 9022e9949f
18 changed files with 69 additions and 69 deletions

View file

@ -326,7 +326,7 @@ BlazeComponent.extendComponent({
return ret;
},
isBackgroundImage() {
//const currentBoard = Boards.findOne(Session.get('currentBoard'));
//const currentBoard = Utils.getCurrentBoard();
//return currentBoard.backgroundImageURL === $(".attachment-thumbnail-img").attr("src");
return false;
},
@ -342,14 +342,14 @@ BlazeComponent.extendComponent({
Popup.back();
},
'click .js-add-background-image'() {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
const currentBoard = Utils.getCurrentBoard();
currentBoard.setBackgroundImageURL(attachmentActionsLink);
Utils.setBackgroundImage(attachmentActionsLink);
Popup.back();
event.preventDefault();
},
'click .js-remove-background-image'() {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
const currentBoard = Utils.getCurrentBoard();
currentBoard.setBackgroundImageURL("");
Utils.setBackgroundImage("");
Popup.back();

View file

@ -727,7 +727,7 @@ BlazeComponent.extendComponent({
}).register('editCardTitleForm');
Template.cardMembersPopup.onCreated(function () {
let currBoard = Boards.findOne(Session.get('currentBoard'));
let currBoard = Utils.getCurrentBoard();
let members = currBoard.activeMembers();
// let query = {
@ -757,7 +757,7 @@ Template.cardMembersPopup.helpers({
});
const filterMembers = (filterTerm) => {
let currBoard = Boards.findOne(Session.get('currentBoard'));
let currBoard = Utils.getCurrentBoard();
let members = currBoard.activeMembers();
// let query = {
@ -1597,7 +1597,7 @@ EscapeActions.register(
);
Template.cardAssigneesPopup.onCreated(function () {
let currBoard = Boards.findOne(Session.get('currentBoard'));
let currBoard = Utils.getCurrentBoard();
let members = currBoard.activeMembers();
// let query = {

View file

@ -32,7 +32,7 @@ Template.createLabelPopup.helpers({
// is not already used in the board (although it's not a problem if two
// labels have the same color).
defaultColor() {
const labels = Boards.findOne(Session.get('currentBoard')).labels;
const labels = Utils.getCurrentBoard().labels;
const usedColors = _.pluck(labels, 'color');
const availableColors = _.difference(labelColors, usedColors);
return availableColors.length > 1 ? availableColors[0] : labelColors[0];
@ -117,7 +117,7 @@ Template.createLabelPopup.events({
// Create the new label
'submit .create-label'(event, templateInstance) {
event.preventDefault();
const board = Boards.findOne(Session.get('currentBoard'));
const board = Utils.getCurrentBoard();
const name = templateInstance
.$('#labelName')
.val()
@ -130,13 +130,13 @@ Template.createLabelPopup.events({
Template.editLabelPopup.events({
'click .js-delete-label': Popup.afterConfirm('deleteLabel', function () {
const board = Boards.findOne(Session.get('currentBoard'));
const board = Utils.getCurrentBoard();
board.removeLabel(this._id);
Popup.back(2);
}),
'submit .edit-label'(event, templateInstance) {
event.preventDefault();
const board = Boards.findOne(Session.get('currentBoard'));
const board = Utils.getCurrentBoard();
const name = templateInstance
.$('#labelName')
.val()