|
@@ -1,7 +1,7 @@
|
|
Meteor.methods({
|
|
Meteor.methods({
|
|
importTrelloCard(trelloCard, listId, sortIndex) {
|
|
importTrelloCard(trelloCard, listId, sortIndex) {
|
|
// 1. check parameters are ok from a syntax point of view
|
|
// 1. check parameters are ok from a syntax point of view
|
|
- DateString = Match.Where(function (dateAsString) {
|
|
|
|
|
|
+ const DateString = Match.Where(function (dateAsString) {
|
|
check(dateAsString, String);
|
|
check(dateAsString, String);
|
|
return moment(dateAsString, moment.ISO_8601).isValid();
|
|
return moment(dateAsString, moment.ISO_8601).isValid();
|
|
});
|
|
});
|
|
@@ -25,9 +25,6 @@ Meteor.methods({
|
|
check(listId, String);
|
|
check(listId, String);
|
|
check(sortIndex, Number);
|
|
check(sortIndex, Number);
|
|
} catch(e) {
|
|
} catch(e) {
|
|
- if(Meteor.isServer) {
|
|
|
|
- console.log(e);
|
|
|
|
- }
|
|
|
|
throw new Meteor.Error('error-json-schema');
|
|
throw new Meteor.Error('error-json-schema');
|
|
}
|
|
}
|
|
|
|
|
|
@@ -59,7 +56,9 @@ Meteor.methods({
|
|
};
|
|
};
|
|
|
|
|
|
// 4. find actual creation date
|
|
// 4. find actual creation date
|
|
- const creationAction = trelloCard.actions.find((action) => {return action.type === 'createCard';});
|
|
|
|
|
|
+ const creationAction = trelloCard.actions.find((action) => {
|
|
|
|
+ return action.type === 'createCard';
|
|
|
|
+ });
|
|
if(creationAction) {
|
|
if(creationAction) {
|
|
cardToCreate.createdAt = creationAction.date;
|
|
cardToCreate.createdAt = creationAction.date;
|
|
}
|
|
}
|
|
@@ -92,7 +91,7 @@ Meteor.methods({
|
|
Activities.direct.insert({
|
|
Activities.direct.insert({
|
|
activityType: 'importCard',
|
|
activityType: 'importCard',
|
|
boardId: cardToCreate.boardId,
|
|
boardId: cardToCreate.boardId,
|
|
- cardId: cardId,
|
|
|
|
|
|
+ cardId,
|
|
createdAt: dateOfImport,
|
|
createdAt: dateOfImport,
|
|
listId: cardToCreate.listId,
|
|
listId: cardToCreate.listId,
|
|
source: {
|
|
source: {
|
|
@@ -109,7 +108,7 @@ Meteor.methods({
|
|
if(currentAction.type === 'commentCard') {
|
|
if(currentAction.type === 'commentCard') {
|
|
const commentToCreate = {
|
|
const commentToCreate = {
|
|
boardId: list.boardId,
|
|
boardId: list.boardId,
|
|
- cardId: cardId,
|
|
|
|
|
|
+ cardId,
|
|
createdAt: currentAction.date,
|
|
createdAt: currentAction.date,
|
|
text: currentAction.data.text,
|
|
text: currentAction.data.text,
|
|
// XXX use the original comment user instead
|
|
// XXX use the original comment user instead
|
|
@@ -120,7 +119,7 @@ Meteor.methods({
|
|
activityType: 'addComment',
|
|
activityType: 'addComment',
|
|
boardId: commentToCreate.boardId,
|
|
boardId: commentToCreate.boardId,
|
|
cardId: commentToCreate.cardId,
|
|
cardId: commentToCreate.cardId,
|
|
- commentId: commentId,
|
|
|
|
|
|
+ commentId,
|
|
createdAt: commentToCreate.createdAt,
|
|
createdAt: commentToCreate.createdAt,
|
|
userId: commentToCreate.userId,
|
|
userId: commentToCreate.userId,
|
|
});
|
|
});
|