mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Move every CustomFields.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/)
This commit is contained in:
parent
47c70f03a2
commit
981a641bce
6 changed files with 11 additions and 10 deletions
|
@ -648,7 +648,7 @@ Boards.helpers({
|
|||
|
||||
// copy custom field definitions
|
||||
const cfMap = {};
|
||||
CustomFields.find({ boardIds: oldId }).forEach(cf => {
|
||||
ReactiveCache.getCustomFields({ boardIds: oldId }).forEach(cf => {
|
||||
const id = cf._id;
|
||||
delete cf._id;
|
||||
cf.boardIds = [_id];
|
||||
|
@ -966,10 +966,11 @@ Boards.helpers({
|
|||
},
|
||||
|
||||
customFields() {
|
||||
return CustomFields.find(
|
||||
const ret = ReactiveCache.getCustomFields(
|
||||
{ boardIds: { $in: [this._id] } },
|
||||
{ sort: { name: 1 } },
|
||||
);
|
||||
return ret;
|
||||
},
|
||||
|
||||
// XXX currently mutations return no value so we have an issue when using addLabel in import
|
||||
|
|
|
@ -3332,7 +3332,7 @@ if (Meteor.isServer) {
|
|||
|
||||
let customFieldsArr = [];
|
||||
_.forEach(
|
||||
CustomFields.find({'boardIds': paramBoardId}).fetch(),
|
||||
ReactiveCache.getCustomFields({'boardIds': paramBoardId}),
|
||||
function (field) {
|
||||
if (field.automaticallyOnCard || field.alwaysOnCard)
|
||||
customFieldsArr.push({ _id: field._id, value: null });
|
||||
|
|
|
@ -307,7 +307,7 @@ if (Meteor.isServer) {
|
|||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: CustomFields.find({ boardIds: { $in: [paramBoardId] } }).map(
|
||||
data: ReactiveCache.getCustomFields({ boardIds: { $in: [paramBoardId] } }).map(
|
||||
function(cf) {
|
||||
return {
|
||||
_id: cf._id,
|
||||
|
|
|
@ -100,10 +100,10 @@ export class Exporter {
|
|||
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
||||
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
||||
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
||||
result.customFields = CustomFields.find(
|
||||
result.customFields = ReactiveCache.getCustomFields(
|
||||
{ boardIds: this._boardId },
|
||||
{ fields: { boardIds: 0 } },
|
||||
).fetch();
|
||||
);
|
||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||
|
|
|
@ -43,7 +43,7 @@ class ExporterCardPDF {
|
|||
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
||||
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
||||
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
||||
result.customFields = CustomFields.find(
|
||||
result.customFields = ReactiveCache.getCustomFields(
|
||||
{
|
||||
boardIds: {
|
||||
$in: [this.boardId],
|
||||
|
@ -54,7 +54,7 @@ class ExporterCardPDF {
|
|||
boardId: 0,
|
||||
},
|
||||
},
|
||||
).fetch();
|
||||
);
|
||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||
|
|
|
@ -45,7 +45,7 @@ class ExporterExcel {
|
|||
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
||||
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
||||
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
||||
result.customFields = CustomFields.find(
|
||||
result.customFields = ReactiveCache.getCustomFields(
|
||||
{
|
||||
boardIds: {
|
||||
$in: [this.boardId],
|
||||
|
@ -56,7 +56,7 @@ class ExporterExcel {
|
|||
boardId: 0,
|
||||
},
|
||||
},
|
||||
).fetch();
|
||||
);
|
||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue