Compare commits

...
8 Commits
9 changed files with 137 additions and 11 deletions

No files matched your search

+9
View File
@@ -1,3 +1,12 @@
# v4.58 2020-12-09 Wekan release
This release fixes the following bugs:
- [Fix issues when duplicating board](https://github.com/wekan/wekan/pull/3387).
Thanks to daniel-eder.
Thanks to above GitHub users for their contributions and translators for their translations.
# v4.57 2020-12-08 Wekan release
This release adds the following new features:
+1 -1
View File
@@ -1,5 +1,5 @@
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
appVersion: "v4.57.0"
appVersion: "v4.58.0"
files:
userUploads:
- README.md
+17 -3
View File
@@ -42,9 +42,23 @@ Meteor.methods({
check(currentBoardId, Match.Maybe(String));
const exporter = new Exporter(sourceBoardId);
const data = exporter.build();
const addData = {};
addData.membersMapping = getMembersToMap(data);
const creator = new WekanCreator(addData);
const additionalData = {};
//get the members to map
const membersMapping = getMembersToMap(data);
//now mirror the mapping done in finishImport in client/components/import/import.js:
if (membersMapping) {
const mappingById = {};
membersMapping.forEach(member => {
if (member.wekanId) {
mappingById[member.id] = member.wekanId;
}
});
additionalData.membersMapping = mappingById;
}
const creator = new WekanCreator(additionalData);
//data.title = `${data.title } - ${ TAPi18n.__('copy-tag')}`;
data.title = `${data.title}`;
return creator.create(data, currentBoardId);
+103
View File
@@ -15,6 +15,7 @@ export class WekanCreator {
cards: {},
lists: {},
swimlanes: {},
customFields: {},
};
// The object creator Wekan Id, indexed by the object Wekan id
// (so we only parse actions once!)
@@ -30,6 +31,8 @@ export class WekanCreator {
this.lists = {};
// Map of cards Wekan ID => Wekan ID
this.cards = {};
// Map of custom fields Wekan ID => Wekan ID
this.customFields = {};
// Map of comments Wekan ID => Wekan ID
this.commentIds = {};
// Map of attachments Wekan ID => Wekan ID
@@ -244,6 +247,7 @@ export class WekanCreator {
swimlaneId: false,
},
],
presentParentTask: boardToImport.presentParentTask,
// Standalone Export has modifiedAt missing, adding modifiedAt to fix it
modifiedAt: this._now(boardToImport.modifiedAt),
permission: boardToImport.permission,
@@ -352,10 +356,40 @@ export class WekanCreator {
cardToCreate.members = wekanMembers;
}
}
// add assignees
if (card.assignees) {
const wekanAssignees = [];
// we can't just map, as some members may not have been mapped
card.assignees.forEach(sourceMemberId => {
if (this.members[sourceMemberId]) {
const wekanId = this.members[sourceMemberId];
// we may map multiple Wekan members to the same wekan user
// in which case we risk adding the same user multiple times
if (!wekanAssignees.find(wId => wId === wekanId)) {
wekanAssignees.push(wekanId);
}
}
return true;
});
if (wekanAssignees.length > 0) {
cardToCreate.assignees = wekanAssignees;
}
}
// set color
if (card.color) {
cardToCreate.color = card.color;
}
// add custom fields
if (card.customFields) {
cardToCreate.customFields = card.customFields.map(field => {
return {
_id: this.customFields[field._id],
value: field.value,
};
});
}
// insert card
const cardId = Cards.direct.insert(cardToCreate);
// keep track of Wekan id => Wekan id
@@ -481,6 +515,39 @@ export class WekanCreator {
return result;
}
/**
* Create the Wekan custom fields corresponding to the supplied Wekan
* custom fields.
* @param wekanCustomFields
* @param boardId
*/
createCustomFields(wekanCustomFields, boardId) {
wekanCustomFields.forEach((field, fieldIndex) => {
const fieldToCreate = {
boardIds: [boardId],
name: field.name,
type: field.type,
settings: field.settings,
showOnCard: field.showOnCard,
showLabelOnMiniCard: field.showLabelOnMiniCard,
automaticallyOnCard: field.automaticallyOnCard,
//use date "now" if now created at date is provided (e.g. for very old boards)
createdAt: this._now(this.createdAt.customFields[field._id]),
modifiedAt: field.modifiedAt,
};
//insert copy of custom field
const fieldId = CustomFields.direct.insert(fieldToCreate);
//set modified date to now
CustomFields.direct.update(fieldId, {
$set: {
modifiedAt: this._now(),
},
});
//store mapping of old id to new id
this.customFields[field._id] = fieldId;
});
}
// Create labels if they do not exist and load this.labels.
createLabels(wekanLabels, board) {
wekanLabels.forEach(label => {
@@ -560,6 +627,35 @@ export class WekanCreator {
});
}
createSubtasks(wekanCards) {
wekanCards.forEach(card => {
// get new id of card (in created / new board)
const cardIdInNewBoard = this.cards[card._id];
//If there is a mapped parent card, use the mapped card
// this means, the card and parent were in the same source board
//If there is no mapped parent card, use the original parent id,
// this should handle cases where source and parent are in different boards
// Note: This can only handle board cloning (within the same wekan instance).
// When importing boards between instances the IDs are definitely
// lost if source and parent are two different boards
// This is not the place to fix it, the entire subtask system needs to be rethought there.
const parentIdInNewBoard = this.cards[card.parentId]
? this.cards[card.parentId]
: card.parentId;
//if the parent card exists, proceed
if (Cards.findOne(parentIdInNewBoard)) {
//set parent id of the card in the new board to the new id of the parent
Cards.direct.update(cardIdInNewBoard, {
$set: {
parentId: parentIdInNewBoard,
},
});
}
});
}
createChecklists(wekanChecklists) {
const result = [];
wekanChecklists.forEach((checklist, checklistIndex) => {
@@ -690,6 +786,11 @@ export class WekanCreator {
this.createdAt.swimlanes[swimlaneId] = activity.createdAt;
break;
}
case 'createCustomField': {
const customFieldId = activity.customFieldId;
this.createdAt.customFields[customFieldId] = activity.createdAt;
break;
}
}
});
}
@@ -840,7 +941,9 @@ export class WekanCreator {
const boardId = this.createBoardAndLabels(board);
this.createLists(board.lists, boardId);
this.createSwimlanes(board.swimlanes, boardId);
this.createCustomFields(board.customFields, boardId);
this.createCards(board.cards, boardId);
this.createSubtasks(board.cards);
this.createChecklists(board.checklists);
this.createChecklistItems(board.checklistItems);
this.importActivities(board.activities, boardId);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wekan",
"version": "v4.57.0",
"version": "v4.58.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wekan",
"version": "v4.57.0",
"version": "v4.58.0",
"description": "Open-Source kanban",
"private": true,
"scripts": {
+2 -2
View File
@@ -1524,7 +1524,7 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc
<ul class="toc-list-h1">
<li>
<a href="#wekan-rest-api" class="toc-h1 toc-link" data-title="Wekan REST API v4.57">Wekan REST API v4.57</a>
<a href="#wekan-rest-api" class="toc-h1 toc-link" data-title="Wekan REST API v4.58">Wekan REST API v4.58</a>
</li>
@@ -2032,7 +2032,7 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc
<div class="page-wrapper">
<div class="dark-box"></div>
<div class="content">
<h1 id="wekan-rest-api">Wekan REST API v4.57</h1>
<h1 id="wekan-rest-api">Wekan REST API v4.58</h1>
<blockquote>
<p>Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.</p>
</blockquote>
+1 -1
View File
@@ -1,7 +1,7 @@
swagger: '2.0'
info:
title: Wekan REST API
version: v4.57
version: v4.58
description: |
The REST API allows you to control and extend Wekan with ease.
+2 -2
View File
@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
appTitle = (defaultText = "Wekan"),
# The name of the app as it is displayed to the user.
appVersion = 457,
appVersion = 458,
# Increment this for every release.
appMarketingVersion = (defaultText = "4.57.0~2020-12-08"),
appMarketingVersion = (defaultText = "4.58.0~2020-12-09"),
# Human-readable presentation of the app version.
minUpgradableAppVersion = 0,