summaryrefslogtreecommitdiffstats
path: root/models/customFields.js
diff options
context:
space:
mode:
authorPouyan Savoli <papoola@hotmail.com>2017-08-27 22:31:24 +0200
committerPouyan Savoli <papoola@hotmail.com>2017-09-22 22:59:32 +0200
commitafd87e3caa1fedbe8fe5dbaefa485fee1ed85c71 (patch)
tree1ebd0ab35da1555e98aef2741119dee84120a5b1 /models/customFields.js
parentade3c02122d262c72bd7c4fd1cbcab8e136184ba (diff)
downloadwekan-afd87e3caa1fedbe8fe5dbaefa485fee1ed85c71.tar.gz
wekan-afd87e3caa1fedbe8fe5dbaefa485fee1ed85c71.tar.bz2
wekan-afd87e3caa1fedbe8fe5dbaefa485fee1ed85c71.zip
many custom fields model and UI enhancements
Diffstat (limited to 'models/customFields.js')
-rw-r--r--models/customFields.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/models/customFields.js b/models/customFields.js
index 75ee55e8..5e76db35 100644
--- a/models/customFields.js
+++ b/models/customFields.js
@@ -25,7 +25,7 @@ CustomFields.allow({
remove(userId, doc) {
return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
},
- fetch: ['boardId'],
+ fetch: ['userId', 'boardId'],
});
// not sure if we need this?
@@ -41,21 +41,18 @@ function customFieldCreation(userId, doc){
}
if (Meteor.isServer) {
- // Comments are often fetched within a card, so we create an index to make these
- // queries more efficient.
- Meteor.startup(() => {
- CardComments._collection._ensureIndex({ cardId: 1, createdAt: -1 });
- });
+ /*Meteor.startup(() => {
+ CustomFields._collection._ensureIndex({ boardId: 1});
+ });*/
CustomFields.after.insert((userId, doc) => {
customFieldCreation(userId, doc);
});
CustomFields.after.remove((userId, doc) => {
- const activity = Activities.findOne({ customFieldId: doc._id });
- if (activity) {
- Activities.remove(activity._id);
- }
+ Activities.remove({
+ customFieldId: doc._id,
+ });
});
}
@@ -70,7 +67,7 @@ if (Meteor.isServer) {
});
});
- JsonRoutes.add('GET', '/api/boards/:boardId/comments/:customFieldId', function (req, res, next) {
+ JsonRoutes.add('GET', '/api/boards/:boardId/custom-fields/:customFieldId', function (req, res, next) {
Authentication.checkUserId( req.userId);
const paramBoardId = req.params.boardId;
const paramCustomFieldId = req.params.customFieldId;
@@ -90,7 +87,7 @@ if (Meteor.isServer) {
boardId: paramBoardId,
});
- const customField = CustomFields.findOne({_id: id, cardId:paramCardId, boardId: paramBoardId });
+ const customField = CustomFields.findOne({_id: id, boardId: paramBoardId });
customFieldCreation(req.body.authorId, customField);
JsonRoutes.sendResult(res, {