mirror of
https://github.com/wekan/wekan.git
synced 2025-12-26 20:28:48 +01:00
Bug fix: Rules for moving from list/swimlane
Issue: 3703
This commit is contained in:
parent
769bb7a55d
commit
17ab5978ad
2 changed files with 22 additions and 9 deletions
|
|
@ -2335,11 +2335,12 @@ if (Meteor.isServer) {
|
||||||
const card = Cards.findOne(doc._id);
|
const card = Cards.findOne(doc._id);
|
||||||
const list = card.list();
|
const list = card.list();
|
||||||
if (list) {
|
if (list) {
|
||||||
// change list modifiedAt, when user modified the key values in timingaction array, if it's endAt, put the modifiedAt of list back to one year ago for sorting purpose
|
// change list modifiedAt, when user modified the key values in
|
||||||
const modifiedAt = new Date(
|
// timingaction array, if it's endAt, put the modifiedAt of list
|
||||||
new Date(value).getTime() -
|
// back to one year ago for sorting purpose
|
||||||
(action === 'endAt' ? 365 * 24 * 3600 * 1e3 : 0),
|
const modifiedAt = moment()
|
||||||
); // set it as 1 year before
|
.subtract(1, 'year')
|
||||||
|
.toISOString();
|
||||||
const boardId = list.boardId;
|
const boardId = list.boardId;
|
||||||
Lists.direct.update(
|
Lists.direct.update(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,26 @@ RulesHelper = {
|
||||||
},
|
},
|
||||||
buildMatchingFieldsMap(activity, matchingFields) {
|
buildMatchingFieldsMap(activity, matchingFields) {
|
||||||
const matchingMap = { activityType: activity.activityType };
|
const matchingMap = { activityType: activity.activityType };
|
||||||
for (let i = 0; i < matchingFields.length; i++) {
|
matchingFields.forEach(field => {
|
||||||
// Creating a matching map with the actual field of the activity
|
// Creating a matching map with the actual field of the activity
|
||||||
// and with the wildcard (for example: trigger when a card is added
|
// and with the wildcard (for example: trigger when a card is added
|
||||||
// in any [*] board
|
// in any [*] board
|
||||||
matchingMap[matchingFields[i]] = {
|
let value = activity[field];
|
||||||
$in: [activity[matchingFields[i]], '*'],
|
if (field === 'oldListName') {
|
||||||
|
const oldList = Lists.findOne({ _id: activity.oldListId });
|
||||||
|
if (oldList) {
|
||||||
|
value = oldList.title;
|
||||||
|
}
|
||||||
|
} else if (field === 'oldSwimlaneName') {
|
||||||
|
const oldSwimlane = Swimlanes.findOne({ _id: activity.oldSwimlaneId });
|
||||||
|
if (oldSwimlane) {
|
||||||
|
value = oldSwimlane.title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matchingMap[field] = {
|
||||||
|
$in: [value, '*'],
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
return matchingMap;
|
return matchingMap;
|
||||||
},
|
},
|
||||||
performAction(activity, action) {
|
performAction(activity, action) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue