mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02: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
|
// copy custom field definitions
|
||||||
const cfMap = {};
|
const cfMap = {};
|
||||||
CustomFields.find({ boardIds: oldId }).forEach(cf => {
|
ReactiveCache.getCustomFields({ boardIds: oldId }).forEach(cf => {
|
||||||
const id = cf._id;
|
const id = cf._id;
|
||||||
delete cf._id;
|
delete cf._id;
|
||||||
cf.boardIds = [_id];
|
cf.boardIds = [_id];
|
||||||
|
@ -966,10 +966,11 @@ Boards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
customFields() {
|
customFields() {
|
||||||
return CustomFields.find(
|
const ret = ReactiveCache.getCustomFields(
|
||||||
{ boardIds: { $in: [this._id] } },
|
{ boardIds: { $in: [this._id] } },
|
||||||
{ sort: { name: 1 } },
|
{ sort: { name: 1 } },
|
||||||
);
|
);
|
||||||
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX currently mutations return no value so we have an issue when using addLabel in import
|
// 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 = [];
|
let customFieldsArr = [];
|
||||||
_.forEach(
|
_.forEach(
|
||||||
CustomFields.find({'boardIds': paramBoardId}).fetch(),
|
ReactiveCache.getCustomFields({'boardIds': paramBoardId}),
|
||||||
function (field) {
|
function (field) {
|
||||||
if (field.automaticallyOnCard || field.alwaysOnCard)
|
if (field.automaticallyOnCard || field.alwaysOnCard)
|
||||||
customFieldsArr.push({ _id: field._id, value: null });
|
customFieldsArr.push({ _id: field._id, value: null });
|
||||||
|
|
|
@ -307,7 +307,7 @@ if (Meteor.isServer) {
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: CustomFields.find({ boardIds: { $in: [paramBoardId] } }).map(
|
data: ReactiveCache.getCustomFields({ boardIds: { $in: [paramBoardId] } }).map(
|
||||||
function(cf) {
|
function(cf) {
|
||||||
return {
|
return {
|
||||||
_id: cf._id,
|
_id: cf._id,
|
||||||
|
|
|
@ -100,10 +100,10 @@ export class Exporter {
|
||||||
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
||||||
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
||||||
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
||||||
result.customFields = CustomFields.find(
|
result.customFields = ReactiveCache.getCustomFields(
|
||||||
{ boardIds: this._boardId },
|
{ boardIds: this._boardId },
|
||||||
{ fields: { boardIds: 0 } },
|
{ fields: { boardIds: 0 } },
|
||||||
).fetch();
|
);
|
||||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ExporterCardPDF {
|
||||||
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
||||||
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
||||||
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
||||||
result.customFields = CustomFields.find(
|
result.customFields = ReactiveCache.getCustomFields(
|
||||||
{
|
{
|
||||||
boardIds: {
|
boardIds: {
|
||||||
$in: [this.boardId],
|
$in: [this.boardId],
|
||||||
|
@ -54,7 +54,7 @@ class ExporterCardPDF {
|
||||||
boardId: 0,
|
boardId: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
).fetch();
|
);
|
||||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ExporterExcel {
|
||||||
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
|
||||||
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
|
||||||
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
|
||||||
result.customFields = CustomFields.find(
|
result.customFields = ReactiveCache.getCustomFields(
|
||||||
{
|
{
|
||||||
boardIds: {
|
boardIds: {
|
||||||
$in: [this.boardId],
|
$in: [this.boardId],
|
||||||
|
@ -56,7 +56,7 @@ class ExporterExcel {
|
||||||
boardId: 0,
|
boardId: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
).fetch();
|
);
|
||||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue