summaryrefslogtreecommitdiffstats
path: root/models/triggers.js
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-09-05 12:29:45 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-09-05 12:29:45 -0500
commit3b9f2ca7c2fffa230bb0c6d4254a88deb9fbb023 (patch)
tree356ab6f5693852464bdb975934c53f63445e6d5f /models/triggers.js
parent2c78aab3dc91ee276bfb5e4717ada72dc84ca3b0 (diff)
downloadwekan-3b9f2ca7c2fffa230bb0c6d4254a88deb9fbb023.tar.gz
wekan-3b9f2ca7c2fffa230bb0c6d4254a88deb9fbb023.tar.bz2
wekan-3b9f2ca7c2fffa230bb0c6d4254a88deb9fbb023.zip
Fixes #2596 incorrect date types for created & updated
Diffstat (limited to 'models/triggers.js')
-rw-r--r--models/triggers.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/triggers.js b/models/triggers.js
index 45f5e6fc..a95b1235 100644
--- a/models/triggers.js
+++ b/models/triggers.js
@@ -12,6 +12,16 @@ Triggers.mutations({
},
});
+Triggers.before.insert((userId, doc) => {
+ doc.createdAt = new Date();
+ doc.updatedAt = doc.createdAt;
+});
+
+Triggers.before.update((userId, doc, fieldNames, modifier) => {
+ modifier.$set = modifier.$set || {};
+ modifier.$set.updatedAt = new Date();
+});
+
Triggers.allow({
insert(userId, doc) {
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));