wekanCreator.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. const DateString = Match.Where(function (dateAsString) {
  2. check(dateAsString, String);
  3. return moment(dateAsString, moment.ISO_8601).isValid();
  4. });
  5. export class WekanCreator {
  6. constructor(data) {
  7. // we log current date, to use the same timestamp for all our actions.
  8. // this helps to retrieve all elements performed by the same import.
  9. this._nowDate = new Date();
  10. // The object creation dates, indexed by Wekan id
  11. // (so we only parse actions once!)
  12. this.createdAt = {
  13. board: null,
  14. cards: {},
  15. lists: {},
  16. swimlanes: {},
  17. };
  18. // The object creator Wekan Id, indexed by the object Wekan id
  19. // (so we only parse actions once!)
  20. this.createdBy = {
  21. cards: {}, // only cards have a field for that
  22. };
  23. // Map of labels Wekan ID => Wekan ID
  24. this.labels = {};
  25. // Map of swimlanes Wekan ID => Wekan ID
  26. this.swimlanes = {};
  27. // Map of lists Wekan ID => Wekan ID
  28. this.lists = {};
  29. // Map of cards Wekan ID => Wekan ID
  30. this.cards = {};
  31. // Map of comments Wekan ID => Wekan ID
  32. this.commentIds = {};
  33. // Map of attachments Wekan ID => Wekan ID
  34. this.attachmentIds = {};
  35. // Map of checklists Wekan ID => Wekan ID
  36. this.checklists = {};
  37. // Map of checklistItems Wekan ID => Wekan ID
  38. this.checklistItems = {};
  39. // The comments, indexed by Wekan card id (to map when importing cards)
  40. this.comments = {};
  41. // the members, indexed by Wekan member id => Wekan user ID
  42. this.members = data.membersMapping ? data.membersMapping : {};
  43. // maps a wekanCardId to an array of wekanAttachments
  44. this.attachments = {};
  45. }
  46. /**
  47. * If dateString is provided,
  48. * return the Date it represents.
  49. * If not, will return the date when it was first called.
  50. * This is useful for us, as we want all import operations to
  51. * have the exact same date for easier later retrieval.
  52. *
  53. * @param {String} dateString a properly formatted Date
  54. */
  55. _now(dateString) {
  56. if(dateString) {
  57. return new Date(dateString);
  58. }
  59. if(!this._nowDate) {
  60. this._nowDate = new Date();
  61. }
  62. return this._nowDate;
  63. }
  64. /**
  65. * if wekanUserId is provided and we have a mapping,
  66. * return it.
  67. * Otherwise return current logged user.
  68. * @param wekanUserId
  69. * @private
  70. */
  71. _user(wekanUserId) {
  72. if(wekanUserId && this.members[wekanUserId]) {
  73. return this.members[wekanUserId];
  74. }
  75. return Meteor.userId();
  76. }
  77. checkActivities(wekanActivities) {
  78. check(wekanActivities, [Match.ObjectIncluding({
  79. activityType: String,
  80. createdAt: DateString,
  81. })]);
  82. // XXX we could perform more thorough checks based on action type
  83. }
  84. checkBoard(wekanBoard) {
  85. check(wekanBoard, Match.ObjectIncluding({
  86. archived: Boolean,
  87. title: String,
  88. // XXX refine control by validating 'color' against a list of
  89. // allowed values (is it worth the maintenance?)
  90. color: String,
  91. permission: Match.Where((value) => {
  92. return ['private', 'public'].indexOf(value)>= 0;
  93. }),
  94. }));
  95. }
  96. checkCards(wekanCards) {
  97. check(wekanCards, [Match.ObjectIncluding({
  98. archived: Boolean,
  99. dateLastActivity: DateString,
  100. labelIds: [String],
  101. title: String,
  102. sort: Number,
  103. })]);
  104. }
  105. checkLabels(wekanLabels) {
  106. check(wekanLabels, [Match.ObjectIncluding({
  107. // XXX refine control by validating 'color' against a list of allowed
  108. // values (is it worth the maintenance?)
  109. color: String,
  110. })]);
  111. }
  112. checkLists(wekanLists) {
  113. check(wekanLists, [Match.ObjectIncluding({
  114. archived: Boolean,
  115. title: String,
  116. })]);
  117. }
  118. checkSwimlanes(wekanSwimlanes) {
  119. check(wekanSwimlanes, [Match.ObjectIncluding({
  120. archived: Boolean,
  121. title: String,
  122. })]);
  123. }
  124. checkChecklists(wekanChecklists) {
  125. check(wekanChecklists, [Match.ObjectIncluding({
  126. cardId: String,
  127. title: String,
  128. })]);
  129. }
  130. checkChecklistItems(wekanChecklistItems) {
  131. check(wekanChecklistItems, [Match.ObjectIncluding({
  132. cardId: String,
  133. title: String,
  134. })]);
  135. }
  136. // You must call parseActions before calling this one.
  137. createBoardAndLabels(boardToImport) {
  138. const boardToCreate = {
  139. archived: boardToImport.archived,
  140. color: boardToImport.color,
  141. // very old boards won't have a creation activity so no creation date
  142. createdAt: this._now(boardToImport.createdAt),
  143. labels: [],
  144. members: [{
  145. userId: Meteor.userId(),
  146. wekanId: Meteor.userId(),
  147. isActive: true,
  148. isAdmin: true,
  149. isCommentOnly: false,
  150. swimlaneId: false,
  151. }],
  152. // Standalone Export has modifiedAt missing, adding modifiedAt to fix it
  153. modifiedAt: this._now(boardToImport.modifiedAt),
  154. permission: boardToImport.permission,
  155. slug: getSlug(boardToImport.title) || 'board',
  156. stars: 0,
  157. title: boardToImport.title,
  158. };
  159. // now add other members
  160. if(boardToImport.members) {
  161. boardToImport.members.forEach((wekanMember) => {
  162. // do we already have it in our list?
  163. if(!boardToCreate.members.some((member) => member.wekanId === wekanMember.wekanId))
  164. boardToCreate.members.push({
  165. ... wekanMember,
  166. userId: wekanMember.wekanId,
  167. });
  168. });
  169. }
  170. boardToImport.labels.forEach((label) => {
  171. const labelToCreate = {
  172. _id: Random.id(6),
  173. color: label.color,
  174. name: label.name,
  175. };
  176. // We need to remember them by Wekan ID, as this is the only ref we have
  177. // when importing cards.
  178. this.labels[label._id] = labelToCreate._id;
  179. boardToCreate.labels.push(labelToCreate);
  180. });
  181. const boardId = Boards.direct.insert(boardToCreate);
  182. Boards.direct.update(boardId, {$set: {modifiedAt: this._now()}});
  183. // log activity
  184. Activities.direct.insert({
  185. activityType: 'importBoard',
  186. boardId,
  187. createdAt: this._now(),
  188. source: {
  189. id: boardToImport.id,
  190. system: 'Wekan',
  191. },
  192. // We attribute the import to current user,
  193. // not the author from the original object.
  194. userId: this._user(),
  195. });
  196. return boardId;
  197. }
  198. /**
  199. * Create the Wekan cards corresponding to the supplied Wekan cards,
  200. * as well as all linked data: activities, comments, and attachments
  201. * @param wekanCards
  202. * @param boardId
  203. * @returns {Array}
  204. */
  205. createCards(wekanCards, boardId) {
  206. const result = [];
  207. wekanCards.forEach((card) => {
  208. const cardToCreate = {
  209. archived: card.archived,
  210. boardId,
  211. // very old boards won't have a creation activity so no creation date
  212. createdAt: this._now(this.createdAt.cards[card._id]),
  213. dateLastActivity: this._now(),
  214. description: card.description,
  215. listId: this.lists[card.listId],
  216. swimlaneId: this.swimlanes[card.swimlaneId],
  217. sort: card.sort,
  218. title: card.title,
  219. // we attribute the card to its creator if available
  220. userId: this._user(this.createdBy.cards[card._id]),
  221. isOvertime: card.isOvertime || false,
  222. startAt: card.startAt ? this._now(card.startAt) : null,
  223. dueAt: card.dueAt ? this._now(card.dueAt) : null,
  224. spentTime: card.spentTime || null,
  225. };
  226. // add labels
  227. if (card.labelIds) {
  228. cardToCreate.labelIds = card.labelIds.map((wekanId) => {
  229. return this.labels[wekanId];
  230. });
  231. }
  232. // add members {
  233. if(card.members) {
  234. const wekanMembers = [];
  235. // we can't just map, as some members may not have been mapped
  236. card.members.forEach((sourceMemberId) => {
  237. if(this.members[sourceMemberId]) {
  238. const wekanId = this.members[sourceMemberId];
  239. // we may map multiple Wekan members to the same wekan user
  240. // in which case we risk adding the same user multiple times
  241. if(!wekanMembers.find((wId) => wId === wekanId)){
  242. wekanMembers.push(wekanId);
  243. }
  244. }
  245. return true;
  246. });
  247. if(wekanMembers.length>0) {
  248. cardToCreate.members = wekanMembers;
  249. }
  250. }
  251. // insert card
  252. const cardId = Cards.direct.insert(cardToCreate);
  253. // keep track of Wekan id => WeKan id
  254. this.cards[card._id] = cardId;
  255. // // log activity
  256. // Activities.direct.insert({
  257. // activityType: 'importCard',
  258. // boardId,
  259. // cardId,
  260. // createdAt: this._now(),
  261. // listId: cardToCreate.listId,
  262. // source: {
  263. // id: card._id,
  264. // system: 'Wekan',
  265. // },
  266. // // we attribute the import to current user,
  267. // // not the author of the original card
  268. // userId: this._user(),
  269. // });
  270. // add comments
  271. const comments = this.comments[card._id];
  272. if (comments) {
  273. comments.forEach((comment) => {
  274. const commentToCreate = {
  275. boardId,
  276. cardId,
  277. createdAt: this._now(comment.createdAt),
  278. text: comment.text,
  279. // we attribute the comment to the original author, default to current user
  280. userId: this._user(comment.userId),
  281. };
  282. // dateLastActivity will be set from activity insert, no need to
  283. // update it ourselves
  284. const commentId = CardComments.direct.insert(commentToCreate);
  285. this.commentIds[comment._id] = commentId;
  286. // Activities.direct.insert({
  287. // activityType: 'addComment',
  288. // boardId: commentToCreate.boardId,
  289. // cardId: commentToCreate.cardId,
  290. // commentId,
  291. // createdAt: this._now(commentToCreate.createdAt),
  292. // // we attribute the addComment (not the import)
  293. // // to the original author - it is needed by some UI elements.
  294. // userId: commentToCreate.userId,
  295. // });
  296. });
  297. }
  298. const attachments = this.attachments[card._id];
  299. const wekanCoverId = card.coverId;
  300. if (attachments) {
  301. attachments.forEach((att) => {
  302. const file = new FS.File();
  303. // Simulating file.attachData on the client generates multiple errors
  304. // - HEAD returns null, which causes exception down the line
  305. // - the template then tries to display the url to the attachment which causes other errors
  306. // so we make it server only, and let UI catch up once it is done, forget about latency comp.
  307. const self = this;
  308. if(Meteor.isServer) {
  309. if (att.url) {
  310. file.attachData(att.url, function (error) {
  311. file.boardId = boardId;
  312. file.cardId = cardId;
  313. file.userId = self._user(att.userId);
  314. // The field source will only be used to prevent adding
  315. // attachments' related activities automatically
  316. file.source = 'import';
  317. if (error) {
  318. throw(error);
  319. } else {
  320. const wekanAtt = Attachments.insert(file, () => {
  321. // we do nothing
  322. });
  323. self.attachmentIds[att._id] = wekanAtt._id;
  324. //
  325. if(wekanCoverId === att._id) {
  326. Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
  327. }
  328. }
  329. });
  330. } else if (att.file) {
  331. file.attachData(new Buffer(att.file, 'base64'), {type: att.type}, (error) => {
  332. file.name(att.name);
  333. file.boardId = boardId;
  334. file.cardId = cardId;
  335. file.userId = self._user(att.userId);
  336. // The field source will only be used to prevent adding
  337. // attachments' related activities automatically
  338. file.source = 'import';
  339. if (error) {
  340. throw(error);
  341. } else {
  342. const wekanAtt = Attachments.insert(file, () => {
  343. // we do nothing
  344. });
  345. this.attachmentIds[att._id] = wekanAtt._id;
  346. //
  347. if(wekanCoverId === att._id) {
  348. Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
  349. }
  350. }
  351. });
  352. }
  353. }
  354. // todo XXX set cover - if need be
  355. });
  356. }
  357. result.push(cardId);
  358. });
  359. return result;
  360. }
  361. // Create labels if they do not exist and load this.labels.
  362. createLabels(wekanLabels, board) {
  363. wekanLabels.forEach((label) => {
  364. const color = label.color;
  365. const name = label.name;
  366. const existingLabel = board.getLabel(name, color);
  367. if (existingLabel) {
  368. this.labels[label.id] = existingLabel._id;
  369. } else {
  370. const idLabelCreated = board.pushLabel(name, color);
  371. this.labels[label.id] = idLabelCreated;
  372. }
  373. });
  374. }
  375. createLists(wekanLists, boardId) {
  376. wekanLists.forEach((list, listIndex) => {
  377. const listToCreate = {
  378. archived: list.archived,
  379. boardId,
  380. // We are being defensing here by providing a default date (now) if the
  381. // creation date wasn't found on the action log. This happen on old
  382. // Wekan boards (eg from 2013) that didn't log the 'createList' action
  383. // we require.
  384. createdAt: this._now(this.createdAt.lists[list.id]),
  385. title: list.title,
  386. sort: list.sort ? list.sort : listIndex,
  387. };
  388. const listId = Lists.direct.insert(listToCreate);
  389. Lists.direct.update(listId, {$set: {'updatedAt': this._now()}});
  390. this.lists[list._id] = listId;
  391. // // log activity
  392. // Activities.direct.insert({
  393. // activityType: 'importList',
  394. // boardId,
  395. // createdAt: this._now(),
  396. // listId,
  397. // source: {
  398. // id: list._id,
  399. // system: 'Wekan',
  400. // },
  401. // // We attribute the import to current user,
  402. // // not the creator of the original object
  403. // userId: this._user(),
  404. // });
  405. });
  406. }
  407. createSwimlanes(wekanSwimlanes, boardId) {
  408. wekanSwimlanes.forEach((swimlane, swimlaneIndex) => {
  409. const swimlaneToCreate = {
  410. archived: swimlane.archived,
  411. boardId,
  412. // We are being defensing here by providing a default date (now) if the
  413. // creation date wasn't found on the action log. This happen on old
  414. // Wekan boards (eg from 2013) that didn't log the 'createList' action
  415. // we require.
  416. createdAt: this._now(this.createdAt.swimlanes[swimlane._id]),
  417. title: swimlane.title,
  418. sort: swimlane.sort ? swimlane.sort : swimlaneIndex,
  419. };
  420. const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
  421. Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});
  422. this.swimlanes[swimlane._id] = swimlaneId;
  423. });
  424. }
  425. createChecklists(wekanChecklists) {
  426. const result = [];
  427. wekanChecklists.forEach((checklist, checklistIndex) => {
  428. // Create the checklist
  429. const checklistToCreate = {
  430. cardId: this.cards[checklist.cardId],
  431. title: checklist.title,
  432. createdAt: checklist.createdAt,
  433. sort: checklist.sort ? checklist.sort : checklistIndex,
  434. };
  435. const checklistId = Checklists.direct.insert(checklistToCreate);
  436. this.checklists[checklist._id] = checklistId;
  437. result.push(checklistId);
  438. });
  439. return result;
  440. }
  441. createChecklistItems(wekanChecklistItems) {
  442. wekanChecklistItems.forEach((checklistitem, checklistitemIndex) => {
  443. // Create the checklistItem
  444. const checklistItemTocreate = {
  445. title: checklistitem.title,
  446. checklistId: this.checklists[checklistitem.checklistId],
  447. cardId: this.cards[checklistitem.cardId],
  448. sort: checklistitem.sort ? checklistitem.sort : checklistitemIndex,
  449. isFinished: checklistitem.isFinished,
  450. };
  451. const checklistItemId = ChecklistItems.direct.insert(checklistItemTocreate);
  452. this.checklistItems[checklistitem._id] = checklistItemId;
  453. });
  454. }
  455. parseActivities(wekanBoard) {
  456. wekanBoard.activities.forEach((activity) => {
  457. switch (activity.activityType) {
  458. case 'addAttachment': {
  459. // We have to be cautious, because the attachment could have been removed later.
  460. // In that case Wekan still reports its addition, but removes its 'url' field.
  461. // So we test for that
  462. const wekanAttachment = wekanBoard.attachments.filter((attachment) => {
  463. return attachment._id === activity.attachmentId;
  464. })[0];
  465. if ( typeof wekanAttachment !== 'undefined' && wekanAttachment ) {
  466. if(wekanAttachment.url || wekanAttachment.file) {
  467. // we cannot actually create the Wekan attachment, because we don't yet
  468. // have the cards to attach it to, so we store it in the instance variable.
  469. const wekanCardId = activity.cardId;
  470. if(!this.attachments[wekanCardId]) {
  471. this.attachments[wekanCardId] = [];
  472. }
  473. this.attachments[wekanCardId].push(wekanAttachment);
  474. }
  475. }
  476. break;
  477. }
  478. case 'addComment': {
  479. const wekanComment = wekanBoard.comments.filter((comment) => {
  480. return comment._id === activity.commentId;
  481. })[0];
  482. const id = activity.cardId;
  483. if (!this.comments[id]) {
  484. this.comments[id] = [];
  485. }
  486. this.comments[id].push(wekanComment);
  487. break;
  488. }
  489. case 'createBoard': {
  490. this.createdAt.board = activity.createdAt;
  491. break;
  492. }
  493. case 'createCard': {
  494. const cardId = activity.cardId;
  495. this.createdAt.cards[cardId] = activity.createdAt;
  496. this.createdBy.cards[cardId] = activity.userId;
  497. break;
  498. }
  499. case 'createList': {
  500. const listId = activity.listId;
  501. this.createdAt.lists[listId] = activity.createdAt;
  502. break;
  503. }
  504. case 'createSwimlane': {
  505. const swimlaneId = activity.swimlaneId;
  506. this.createdAt.swimlanes[swimlaneId] = activity.createdAt;
  507. break;
  508. }}
  509. });
  510. }
  511. importActivities(activities, boardId) {
  512. activities.forEach((activity) => {
  513. switch (activity.activityType) {
  514. // Board related activities
  515. // TODO: addBoardMember, removeBoardMember
  516. case 'createBoard': {
  517. Activities.direct.insert({
  518. userId: this._user(activity.userId),
  519. type: 'board',
  520. activityTypeId: boardId,
  521. activityType: activity.activityType,
  522. boardId,
  523. createdAt: this._now(activity.createdAt),
  524. });
  525. break;
  526. }
  527. // List related activities
  528. // TODO: removeList, archivedList
  529. case 'createList': {
  530. Activities.direct.insert({
  531. userId: this._user(activity.userId),
  532. type: 'list',
  533. activityType: activity.activityType,
  534. listId: this.lists[activity.listId],
  535. boardId,
  536. createdAt: this._now(activity.createdAt),
  537. });
  538. break;
  539. }
  540. // Card related activities
  541. // TODO: archivedCard, restoredCard, joinMember, unjoinMember
  542. case 'createCard': {
  543. Activities.direct.insert({
  544. userId: this._user(activity.userId),
  545. activityType: activity.activityType,
  546. listId: this.lists[activity.listId],
  547. cardId: this.cards[activity.cardId],
  548. boardId,
  549. createdAt: this._now(activity.createdAt),
  550. });
  551. break;
  552. }
  553. case 'moveCard': {
  554. Activities.direct.insert({
  555. userId: this._user(activity.userId),
  556. oldListId: this.lists[activity.oldListId],
  557. activityType: activity.activityType,
  558. listId: this.lists[activity.listId],
  559. cardId: this.cards[activity.cardId],
  560. boardId,
  561. createdAt: this._now(activity.createdAt),
  562. });
  563. break;
  564. }
  565. // Comment related activities
  566. case 'addComment': {
  567. Activities.direct.insert({
  568. userId: this._user(activity.userId),
  569. activityType: activity.activityType,
  570. cardId: this.cards[activity.cardId],
  571. commentId: this.commentIds[activity.commentId],
  572. boardId,
  573. createdAt: this._now(activity.createdAt),
  574. });
  575. break;
  576. }
  577. // Attachment related activities
  578. case 'addAttachment': {
  579. Activities.direct.insert({
  580. userId: this._user(activity.userId),
  581. type: 'card',
  582. activityType: activity.activityType,
  583. attachmentId: this.attachmentIds[activity.attachmentId],
  584. cardId: this.cards[activity.cardId],
  585. boardId,
  586. createdAt: this._now(activity.createdAt),
  587. });
  588. break;
  589. }
  590. // Checklist related activities
  591. case 'addChecklist': {
  592. Activities.direct.insert({
  593. userId: this._user(activity.userId),
  594. activityType: activity.activityType,
  595. cardId: this.cards[activity.cardId],
  596. checklistId: this.checklists[activity.checklistId],
  597. boardId,
  598. createdAt: this._now(activity.createdAt),
  599. });
  600. break;
  601. }
  602. case 'addChecklistItem': {
  603. Activities.direct.insert({
  604. userId: this._user(activity.userId),
  605. activityType: activity.activityType,
  606. cardId: this.cards[activity.cardId],
  607. checklistId: this.checklists[activity.checklistId],
  608. checklistItemId: activity.checklistItemId.replace(
  609. activity.checklistId,
  610. this.checklists[activity.checklistId]),
  611. boardId,
  612. createdAt: this._now(activity.createdAt),
  613. });
  614. break;
  615. }}
  616. });
  617. }
  618. check(board) {
  619. try {
  620. // check(data, {
  621. // membersMapping: Match.Optional(Object),
  622. // });
  623. this.checkActivities(board.activities);
  624. this.checkBoard(board);
  625. this.checkLabels(board.labels);
  626. this.checkLists(board.lists);
  627. this.checkSwimlanes(board.swimlanes);
  628. this.checkCards(board.cards);
  629. this.checkChecklists(board.checklists);
  630. this.checkChecklistItems(board.checklistItems);
  631. } catch (e) {
  632. throw new Meteor.Error('error-json-schema');
  633. }
  634. }
  635. create(board, currentBoardId) {
  636. // TODO : Make isSandstorm variable global
  637. const isSandstorm = Meteor.settings && Meteor.settings.public &&
  638. Meteor.settings.public.sandstorm;
  639. if (isSandstorm && currentBoardId) {
  640. const currentBoard = Boards.findOne(currentBoardId);
  641. currentBoard.archive();
  642. }
  643. this.parseActivities(board);
  644. const boardId = this.createBoardAndLabels(board);
  645. this.createLists(board.lists, boardId);
  646. this.createSwimlanes(board.swimlanes, boardId);
  647. this.createCards(board.cards, boardId);
  648. this.createChecklists(board.checklists);
  649. this.createChecklistItems(board.checklistItems);
  650. this.importActivities(board.activities, boardId);
  651. // XXX add members
  652. return boardId;
  653. }
  654. }