Import boards in Sandstorm

This commit is contained in:
Ghassen Rjab 2017-07-24 23:56:51 +01:00
parent f34ef01de9
commit d2b1a837e6
8 changed files with 29 additions and 4 deletions

View file

@ -2,10 +2,11 @@ import { TrelloCreator } from './trelloCreator';
import { WekanCreator } from './wekanCreator';
Meteor.methods({
importBoard(board, data, importSource) {
importBoard(board, data, importSource, currentBoard) {
check(board, Object);
check(data, Object);
check(importSource, String);
check(currentBoard, Match.Maybe(String));
let creator;
switch (importSource) {
case 'trello':
@ -23,6 +24,6 @@ Meteor.methods({
// authorized) nothing to check, everyone can import boards in their account
// 3. create all elements
return creator.create(board);
return creator.create(board, currentBoard);
},
});

View file

@ -488,7 +488,14 @@ export class TrelloCreator {
}
}
create(board) {
create(board, currentBoardId) {
// TODO : Make isSandstorm variable global
const isSandstorm = Meteor.settings && Meteor.settings.public &&
Meteor.settings.public.sandstorm;
if (isSandstorm && currentBoardId) {
const currentBoard = Boards.findOne(currentBoardId);
currentBoard.archive();
}
this.parseActions(board.actions);
const boardId = this.createBoardAndLabels(board);
this.createLists(board.lists, boardId);

View file

@ -478,7 +478,14 @@ export class WekanCreator {
}
}
create(board) {
create(board, currentBoardId) {
// TODO : Make isSandstorm variable global
const isSandstorm = Meteor.settings && Meteor.settings.public &&
Meteor.settings.public.sandstorm;
if (isSandstorm && currentBoardId) {
const currentBoard = Boards.findOne(currentBoardId);
currentBoard.archive();
}
this.parseActivities(board);
const boardId = this.createBoardAndLabels(board);
this.createLists(board.lists, boardId);