summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/migrations.js192
-rw-r--r--server/rulesHelper.js74
2 files changed, 244 insertions, 22 deletions
diff --git a/server/migrations.js b/server/migrations.js
index 1b7146c5..12a872a8 100644
--- a/server/migrations.js
+++ b/server/migrations.js
@@ -793,3 +793,195 @@ Migrations.add('add-profile-hiddenMinicardLabelText', () => {
noValidateMulti,
);
});
+
+Migrations.add('add-receiveddate-allowed', () => {
+ Boards.update(
+ {
+ allowsReceivedDate: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsReceivedDate: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-startdate-allowed', () => {
+ Boards.update(
+ {
+ allowsStartDate: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsStartDate: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-duedate-allowed', () => {
+ Boards.update(
+ {
+ allowsDueDate: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsDueDate: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-enddate-allowed', () => {
+ Boards.update(
+ {
+ allowsEndDate: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsEndDate: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-members-allowed', () => {
+ Boards.update(
+ {
+ allowsMembers: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsMembers: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-assignee-allowed', () => {
+ Boards.update(
+ {
+ allowsAssignee: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsAssignee: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-labels-allowed', () => {
+ Boards.update(
+ {
+ allowsLabels: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsLabels: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-checklists-allowed', () => {
+ Boards.update(
+ {
+ allowsChecklists: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsChecklists: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-attachments-allowed', () => {
+ Boards.update(
+ {
+ allowsAttachments: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsAttachments: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-comments-allowed', () => {
+ Boards.update(
+ {
+ allowsComments: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsComments: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-assigned-by-allowed', () => {
+ Boards.update(
+ {
+ allowsAssignedBy: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsAssignedBy: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
+
+Migrations.add('add-requested-by-allowed', () => {
+ Boards.update(
+ {
+ allowsRequestedBy: {
+ $exists: false,
+ },
+ },
+ {
+ $set: {
+ allowsRequestedBy: true,
+ },
+ },
+ noValidateMulti,
+ );
+});
diff --git a/server/rulesHelper.js b/server/rulesHelper.js
index cf278c52..63e330ab 100644
--- a/server/rulesHelper.js
+++ b/server/rulesHelper.js
@@ -42,35 +42,65 @@ RulesHelper = {
performAction(activity, action) {
const card = Cards.findOne({ _id: activity.cardId });
const boardId = activity.boardId;
- if (action.actionType === 'moveCardToTop') {
- let listId;
+ if (
+ action.actionType === 'moveCardToTop' ||
+ action.actionType === 'moveCardToBottom'
+ ) {
let list;
- if (action.listTitle === '*') {
- listId = card.listId;
+ let listId;
+ if (action.listName === '*') {
list = card.list();
+ if (boardId !== action.boardId) {
+ list = Lists.findOne({ title: list.title, boardId: action.boardId });
+ }
} else {
- list = Lists.findOne({ title: action.listTitle, boardId });
- listId = list._id;
+ list = Lists.findOne({
+ title: action.listName,
+ boardId: action.boardId,
+ });
}
- const minOrder = _.min(
- list.cardsUnfiltered(card.swimlaneId).map(c => c.sort),
- );
- card.move(boardId, card.swimlaneId, listId, minOrder - 1);
- }
- if (action.actionType === 'moveCardToBottom') {
- let listId;
- let list;
- if (action.listTitle === '*') {
- listId = card.listId;
- list = card.list();
+ if (list === undefined) {
+ listId = '';
} else {
- list = Lists.findOne({ title: action.listTitle, boardId });
listId = list._id;
}
- const maxOrder = _.max(
- list.cardsUnfiltered(card.swimlaneId).map(c => c.sort),
- );
- card.move(boardId, card.swimlaneId, listId, maxOrder + 1);
+
+ let swimlane;
+ let swimlaneId;
+ if (action.swimlaneName === '*') {
+ swimlane = Swimlanes.findOne(card.swimlaneId);
+ if (boardId !== action.boardId) {
+ swimlane = Swimlanes.findOne({
+ title: swimlane.title,
+ boardId: action.boardId,
+ });
+ }
+ } else {
+ swimlane = Swimlanes.findOne({
+ title: action.swimlaneName,
+ boardId: action.boardId,
+ });
+ }
+ if (swimlane === undefined) {
+ swimlaneId = Swimlanes.findOne({
+ title: 'Default',
+ boardId: action.boardId,
+ })._id;
+ } else {
+ swimlaneId = swimlane._id;
+ }
+
+ if (action.actionType === 'moveCardToTop') {
+ const minOrder = _.min(
+ list.cardsUnfiltered(swimlaneId).map(c => c.sort),
+ );
+ card.move(action.boardId, swimlaneId, listId, minOrder - 1);
+ } else {
+ const maxOrder = _.max(
+ list.cardsUnfiltered(swimlaneId).map(c => c.sort),
+ );
+ card.move(action.boardId, swimlaneId, listId, maxOrder + 1);
+ }
}
if (action.actionType === 'sendEmail') {
const to = action.emailTo;