summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorGhassen Rjab <rjab.ghassen@gmail.com>2017-07-24 23:56:51 +0100
committerGhassen Rjab <rjab.ghassen@gmail.com>2017-07-24 23:56:51 +0100
commitd2b1a837e677b62e10a14c1599c4ff59ee21ff34 (patch)
treefae98d33bf797d84dc282fdf30fe1468cfb5dcd6 /models
parentf34ef01de90bbb1ed3fbbb1deac9cbe968848de8 (diff)
downloadwekan-d2b1a837e677b62e10a14c1599c4ff59ee21ff34.tar.gz
wekan-d2b1a837e677b62e10a14c1599c4ff59ee21ff34.tar.bz2
wekan-d2b1a837e677b62e10a14c1599c4ff59ee21ff34.zip
Import boards in Sandstorm
Diffstat (limited to 'models')
-rw-r--r--models/import.js5
-rw-r--r--models/trelloCreator.js9
-rw-r--r--models/wekanCreator.js9
3 files changed, 19 insertions, 4 deletions
diff --git a/models/import.js b/models/import.js
index 2e58c90f..09769794 100644
--- a/models/import.js
+++ b/models/import.js
@@ -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);
},
});
diff --git a/models/trelloCreator.js b/models/trelloCreator.js
index fbc4a878..aa86a5c8 100644
--- a/models/trelloCreator.js
+++ b/models/trelloCreator.js
@@ -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);
diff --git a/models/wekanCreator.js b/models/wekanCreator.js
index 6dd56fb1..b5f9b0ff 100644
--- a/models/wekanCreator.js
+++ b/models/wekanCreator.js
@@ -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);