summaryrefslogtreecommitdiffstats
path: root/models/cards.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-10-29 19:05:44 +0200
committerLauri Ojansivu <x@xet7.org>2019-10-29 19:05:44 +0200
commit7d6d3af54a2fc1fb68634725eb754b22f02fd430 (patch)
tree8703d32a5489dfce95e026bc535d6459c1743784 /models/cards.js
parent13a2bd6380ced34a828b9469e48786ed21fcb380 (diff)
downloadwekan-7d6d3af54a2fc1fb68634725eb754b22f02fd430.tar.gz
wekan-7d6d3af54a2fc1fb68634725eb754b22f02fd430.tar.bz2
wekan-7d6d3af54a2fc1fb68634725eb754b22f02fd430.zip
Add Features: allowing lists to be sorted by modifiedAt when not in draggable mode.
Bug Fix #2093: the broken should be prior to file attachment feature introduced, and tested export board is working. Thanks to whowillcare ! ( xet7 merged this pull request manually from https://github.com/wekan/wekan/pull/2756 ) Closes #2093
Diffstat (limited to 'models/cards.js')
-rw-r--r--models/cards.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/models/cards.js b/models/cards.js
index 635a4e72..27dda0ee 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -1695,6 +1695,25 @@ if (Meteor.isServer) {
const oldvalue = doc[action] || '';
const activityType = `a-${action}`;
const card = Cards.findOne(doc._id);
+ const list = card.list();
+ if (list && action === 'endAt') {
+ // change list modifiedAt
+ const modifiedAt = new Date(
+ new Date(value).getTime() - 365 * 24 * 3600 * 1e3,
+ ); // set it as 1 year before
+ const boardId = list.boardId;
+ Lists.direct.update(
+ {
+ _id: list._id,
+ },
+ {
+ $set: {
+ modifiedAt,
+ boardId,
+ },
+ },
+ );
+ }
const username = Users.findOne(userId).username;
const activity = {
userId,
@@ -1852,15 +1871,8 @@ if (Meteor.isServer) {
const check = Users.findOne({
_id: req.body.authorId,
});
+ const members = req.body.members || [req.body.authorId];
if (typeof check !== 'undefined') {
- let members = req.body.members || [];
- if (_.isString(members)) {
- if (members === '') {
- members = [];
- } else {
- members = [members];
- }
- }
const id = Cards.direct.insert({
title: req.body.title,
boardId: paramBoardId,