Move every CustomFields.findOne() to the ReactiveCache

This commit is contained in:
Martin Filser 2023-02-03 23:58:38 +01:00
parent 0a7ffe4cb0
commit 54f7361767
4 changed files with 5 additions and 5 deletions

View file

@ -159,7 +159,7 @@ BlazeComponent.extendComponent({
}, },
lastCustomField() { lastCustomField() {
const lastCustomField = CustomFields.findOne( const lastCustomField = ReactiveCache.getCustomField(
this.currentData().activity.customFieldId, this.currentData().activity.customFieldId,
); );
if (!lastCustomField) return null; if (!lastCustomField) return null;
@ -167,7 +167,7 @@ BlazeComponent.extendComponent({
}, },
lastCustomFieldValue() { lastCustomFieldValue() {
const lastCustomField = CustomFields.findOne( const lastCustomField = ReactiveCache.getCustomField(
this.currentData().activity.customFieldId, this.currentData().activity.customFieldId,
); );
if (!lastCustomField) return null; if (!lastCustomField) return null;

View file

@ -275,7 +275,7 @@ const CreateCustomFieldPopup = BlazeComponent.extendComponent({
'click .js-delete-custom-field': Popup.afterConfirm( 'click .js-delete-custom-field': Popup.afterConfirm(
'deleteCustomField', 'deleteCustomField',
function() { function() {
const customField = CustomFields.findOne(this._id); const customField = ReactiveCache.getCustomField(this._id);
if (customField.boardIds.length > 1) { if (customField.boardIds.length > 1) {
CustomFields.update(customField._id, { CustomFields.update(customField._id, {
$pull: { $pull: {

View file

@ -56,7 +56,7 @@ Activities.helpers({
return ReactiveCache.getCard(this.subtaskId); return ReactiveCache.getCard(this.subtaskId);
}, },
customField() { customField() {
return CustomFields.findOne(this.customFieldId); return ReactiveCache.getCustomField(this.customFieldId);
}, },
// Label activity did not work yet, unable to edit labels when tried this. // Label activity did not work yet, unable to edit labels when tried this.
//label() { //label() {

View file

@ -532,7 +532,7 @@ Cards.helpers({
mapCustomFieldsToBoard(boardId) { mapCustomFieldsToBoard(boardId) {
// Map custom fields to new board // Map custom fields to new board
return this.customFields.map(cf => { return this.customFields.map(cf => {
const oldCf = CustomFields.findOne(cf._id); const oldCf = ReactiveCache.getCustomField(cf._id);
const newCf = CustomFields.findOne({ const newCf = CustomFields.findOne({
boardIds: boardId, boardIds: boardId,
name: oldCf.name, name: oldCf.name,