Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
Cards = new Mongo . Collection ( 'cards' ) ;
// XXX To improve pub/sub performances a card document should include a
// de-normalized number of comments so we don't have to publish the whole list
// of comments just to display the number of them in the board view.
2019-06-28 12:52:09 -05:00
Cards . attachSchema (
new SimpleSchema ( {
title : {
/ * *
* the title of the card
* /
type : String ,
optional : true ,
defaultValue : '' ,
2016-04-22 00:59:05 +02:00
} ,
2019-06-28 12:52:09 -05:00
archived : {
/ * *
* is the card archived
* /
type : Boolean ,
// eslint-disable-next-line consistent-return
autoValue ( ) {
// eslint-disable-line consistent-return
if ( this . isInsert && ! this . isSet ) {
return false ;
}
} ,
2016-04-22 00:59:05 +02:00
} ,
2019-06-28 12:52:09 -05:00
parentId : {
/ * *
* ID of the parent card
* /
type : String ,
optional : true ,
defaultValue : '' ,
2019-06-26 17:47:27 -05:00
} ,
2019-06-28 12:52:09 -05:00
listId : {
/ * *
* List ID where the card is
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
swimlaneId : {
/ * *
* Swimlane ID where the card is
* /
type : String ,
} ,
// The system could work without this `boardId` information (we could deduce
// the board identifier from the card), but it would make the system more
// difficult to manage and less efficient.
boardId : {
/ * *
* Board ID of the card
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
coverId : {
/ * *
* Cover ID of the card
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
color : {
type : String ,
optional : true ,
allowedValues : [
'white' ,
'green' ,
'yellow' ,
'orange' ,
'red' ,
'purple' ,
'blue' ,
'sky' ,
'lime' ,
'pink' ,
'black' ,
'silver' ,
'peachpuff' ,
'crimson' ,
'plum' ,
'darkgreen' ,
'slateblue' ,
'magenta' ,
'gold' ,
'navy' ,
'gray' ,
'saddlebrown' ,
'paleturquoise' ,
'mistyrose' ,
'indigo' ,
] ,
} ,
createdAt : {
/ * *
* creation date
* /
type : Date ,
// eslint-disable-next-line consistent-return
autoValue ( ) {
if ( this . isInsert ) {
return new Date ( ) ;
2019-09-05 12:29:45 -05:00
} else if ( this . isUpsert ) {
return { $setOnInsert : new Date ( ) } ;
2019-06-28 12:52:09 -05:00
} else {
this . unset ( ) ;
}
} ,
} ,
modifiedAt : {
type : Date ,
denyUpdate : false ,
// eslint-disable-next-line consistent-return
autoValue ( ) {
if ( this . isInsert || this . isUpsert || this . isUpdate ) {
return new Date ( ) ;
} else {
this . unset ( ) ;
}
2017-08-30 02:54:54 +02:00
} ,
2019-06-28 12:52:09 -05:00
} ,
customFields : {
/ * *
* list of custom fields
* /
type : [ Object ] ,
optional : true ,
defaultValue : [ ] ,
} ,
'customFields.$' : {
type : new SimpleSchema ( {
_id : {
/ * *
* the ID of the related custom field
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
value : {
/ * *
* value attached to the custom field
* /
type : Match . OneOf ( String , Number , Boolean , Date ) ,
optional : true ,
defaultValue : '' ,
} ,
} ) ,
} ,
dateLastActivity : {
/ * *
* Date of last activity
* /
type : Date ,
autoValue ( ) {
return new Date ( ) ;
2017-08-30 02:54:54 +02:00
} ,
2016-04-22 00:59:05 +02:00
} ,
2019-06-28 12:52:09 -05:00
description : {
/ * *
* description of the card
* /
type : String ,
optional : true ,
defaultValue : '' ,
2016-04-22 00:59:05 +02:00
} ,
2019-06-28 12:52:09 -05:00
requestedBy : {
/ * *
* who requested the card ( ID of the user )
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
assignedBy : {
/ * *
* who assigned the card ( ID of the user )
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
labelIds : {
/ * *
* list of labels ID the card has
* /
type : [ String ] ,
optional : true ,
defaultValue : [ ] ,
} ,
members : {
/ * *
* list of members ( user IDs )
* /
type : [ String ] ,
optional : true ,
defaultValue : [ ] ,
} ,
2019-10-31 02:21:50 +02:00
assignees : {
/ * *
2019-11-07 22:46:55 +02:00
* who is assignee of the card ( user ID ) ,
* maximum one ID of assignee in array .
2019-10-31 02:21:50 +02:00
* /
type : [ String ] ,
optional : true ,
defaultValue : [ ] ,
} ,
2019-06-28 12:52:09 -05:00
receivedAt : {
/ * *
* Date the card was received
* /
type : Date ,
optional : true ,
} ,
startAt : {
/ * *
* Date the card was started to be worked on
* /
type : Date ,
optional : true ,
} ,
dueAt : {
/ * *
* Date the card is due
* /
type : Date ,
optional : true ,
} ,
endAt : {
/ * *
* Date the card ended
* /
type : Date ,
optional : true ,
} ,
spentTime : {
/ * *
* How much time has been spent on this
* /
type : Number ,
decimal : true ,
optional : true ,
defaultValue : 0 ,
} ,
isOvertime : {
/ * *
* is the card over time ?
* /
type : Boolean ,
defaultValue : false ,
optional : true ,
} ,
// XXX Should probably be called `authorId`. Is it even needed since we have
// the `members` field?
userId : {
/ * *
* user ID of the author of the card
* /
type : String ,
// eslint-disable-next-line consistent-return
autoValue ( ) {
// eslint-disable-line consistent-return
if ( this . isInsert && ! this . isSet ) {
return this . userId ;
}
} ,
} ,
sort : {
/ * *
* Sort value
* /
type : Number ,
decimal : true ,
2020-05-25 23:26:07 +02:00
defaultValue : 0 ,
2019-06-28 12:52:09 -05:00
} ,
subtaskSort : {
/ * *
* subtask sort value
* /
type : Number ,
decimal : true ,
defaultValue : - 1 ,
optional : true ,
} ,
type : {
/ * *
* type of the card
* /
type : String ,
defaultValue : 'cardType-card' ,
} ,
linkedId : {
/ * *
* ID of the linked card
* /
type : String ,
optional : true ,
defaultValue : '' ,
} ,
2020-04-07 20:43:35 +02:00
vote : {
/ * *
* vote object , see below
* /
type : Object ,
optional : true ,
} ,
'vote.question' : {
type : String ,
defaultValue : '' ,
} ,
'vote.positive' : {
/ * *
* list of members ( user IDs )
* /
type : [ String ] ,
optional : true ,
defaultValue : [ ] ,
} ,
'vote.negative' : {
/ * *
* list of members ( user IDs )
* /
type : [ String ] ,
optional : true ,
defaultValue : [ ] ,
} ,
'vote.end' : {
type : Date ,
optional : true ,
2020-04-08 23:16:48 +03:00
defaultValue : null ,
} ,
2020-04-10 01:46:36 +02:00
'vote.public' : {
type : Boolean ,
defaultValue : false ,
} ,
2020-05-03 00:33:15 +02:00
'vote.allowNonBoardMembers' : {
type : Boolean ,
defaultValue : false ,
} ,
2019-06-28 12:52:09 -05:00
} ) ,
) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
2015-09-08 20:19:42 +02:00
Cards . allow ( {
insert ( userId , doc ) {
return allowIsBoardMember ( userId , Boards . findOne ( doc . boardId ) ) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ,
2020-05-03 00:33:15 +02:00
update ( userId , doc , fields ) {
// Allow board members or logged in users if only vote get's changed
return (
allowIsBoardMember ( userId , Boards . findOne ( doc . boardId ) ) ||
( _ . isEqual ( fields , [ 'vote' , 'modifiedAt' , 'dateLastActivity' ] ) &&
! ! userId )
) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ,
2015-09-08 20:19:42 +02:00
remove ( userId , doc ) {
return allowIsBoardMember ( userId , Boards . findOne ( doc . boardId ) ) ;
2015-09-03 23:12:46 +02:00
} ,
2015-09-08 20:19:42 +02:00
fetch : [ 'boardId' ] ,
} ) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
Cards . helpers ( {
2019-02-27 20:45:58 +01:00
copy ( boardId , swimlaneId , listId ) {
2019-02-24 00:13:35 +01:00
const oldId = this . _id ;
2019-02-27 21:07:13 +01:00
const oldCard = Cards . findOne ( oldId ) ;
2020-06-05 08:29:46 +02:00
// we must only copy the labels and custom fields if the target board
// differs from the source board
if ( this . boardId !== boardId ) {
const oldBoard = Boards . findOne ( this . boardId ) ;
const oldBoardLabels = oldBoard . labels ;
// Get old label names
const oldCardLabels = _ . pluck (
_ . filter ( oldBoardLabels , label => {
return _ . contains ( this . labelIds , label . _id ) ;
} ) ,
'name' ,
) ;
const newBoard = Boards . findOne ( boardId ) ;
const newBoardLabels = newBoard . labels ;
const newCardLabels = _ . pluck (
_ . filter ( newBoardLabels , label => {
return _ . contains ( oldCardLabels , label . name ) ;
} ) ,
'_id' ,
) ;
// now set the new label ids
delete this . labelIds ;
this . labelIds = newCardLabels ;
// Copy Custom Fields
2019-03-16 22:43:47 +01:00
CustomFields . find ( {
2019-06-28 12:52:09 -05:00
_id : {
$in : oldCard . customFields . map ( cf => {
return cf . _id ;
} ) ,
} ,
} ) . forEach ( cf => {
if ( ! _ . contains ( cf . boardIds , boardId ) ) cf . addBoard ( boardId ) ;
2019-03-16 22:43:47 +01:00
} ) ;
}
2019-02-25 22:48:25 +01:00
delete this . _id ;
2019-02-27 20:45:58 +01:00
this . boardId = boardId ;
this . swimlaneId = swimlaneId ;
this . listId = listId ;
2019-02-24 00:13:35 +01:00
const _id = Cards . insert ( this ) ;
2019-02-23 16:36:29 +01:00
2019-02-27 21:07:13 +01:00
// Copy attachments
2020-05-25 17:54:51 +03:00
oldCard . attachments ( ) . forEach ( att => {
att . cardId = _id ;
delete att . _id ;
return Attachments . insert ( att ) ;
2019-02-27 21:07:13 +01:00
} ) ;
2019-02-24 00:13:35 +01:00
// copy checklists
2019-06-28 12:52:09 -05:00
Checklists . find ( { cardId : oldId } ) . forEach ( ch => {
2019-02-24 00:13:35 +01:00
ch . copy ( _id ) ;
} ) ;
2019-02-23 16:36:29 +01:00
2019-02-24 00:13:35 +01:00
// copy subtasks
2019-06-28 12:52:09 -05:00
Cards . find ( { parentId : oldId } ) . forEach ( subtask => {
2019-02-24 00:13:35 +01:00
subtask . parentId = _id ;
subtask . _id = null ;
Cards . insert ( subtask ) ;
} ) ;
2019-02-23 16:36:29 +01:00
2019-02-24 00:13:35 +01:00
// copy card comments
2019-06-28 12:52:09 -05:00
CardComments . find ( { cardId : oldId } ) . forEach ( cmt => {
2019-02-24 00:13:35 +01:00
cmt . copy ( _id ) ;
} ) ;
2019-02-23 16:36:29 +01:00
2019-02-24 00:13:35 +01:00
return _id ;
2019-02-23 16:36:29 +01:00
} ,
2020-04-29 22:38:50 +02:00
link ( boardId , swimlaneId , listId ) {
// TODO is there a better method to create a deepcopy?
linkCard = JSON . parse ( JSON . stringify ( this ) ) ;
// TODO is this how it is meant to be?
linkCard . linkedId = linkCard . linkedId || linkCard . _id ;
linkCard . boardId = boardId ;
linkCard . swimlaneId = swimlaneId ;
linkCard . listId = listId ;
linkCard . type = 'cardType-linkedCard' ;
delete linkCard . _id ;
// TODO shall we copy the labels for a linked card?!
delete linkCard . labelIds ;
return Cards . insert ( linkCard ) ;
} ,
2015-09-03 23:12:46 +02:00
list ( ) {
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
return Lists . findOne ( this . listId ) ;
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
board ( ) {
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
return Boards . findOne ( this . boardId ) ;
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
labels ( ) {
const boardLabels = this . board ( ) . labels ;
2019-06-28 12:52:09 -05:00
const cardLabels = _ . filter ( boardLabels , label => {
2015-09-03 23:12:46 +02:00
return _ . contains ( this . labelIds , label . _id ) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
return cardLabels ;
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
hasLabel ( labelId ) {
2015-05-29 23:35:30 +02:00
return _ . contains ( this . labelIds , labelId ) ;
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
user ( ) {
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
return Users . findOne ( this . userId ) ;
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
isAssigned ( memberId ) {
2018-04-18 01:35:46 -03:00
return _ . contains ( this . getMembers ( ) , memberId ) ;
2015-05-29 23:35:30 +02:00
} ,
2015-09-08 20:19:42 +02:00
2019-10-31 02:21:50 +02:00
isAssignee ( assigneeId ) {
return _ . contains ( this . getAssignees ( ) , assigneeId ) ;
} ,
2015-09-03 23:12:46 +02:00
activities ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Activities . find (
{ cardId : this . linkedId } ,
{ sort : { createdAt : - 1 } } ,
) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Activities . find (
{ boardId : this . linkedId } ,
{ sort : { createdAt : - 1 } } ,
) ;
2018-04-18 01:35:46 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Activities . find ( { cardId : this . _id } , { sort : { createdAt : - 1 } } ) ;
2018-04-18 01:35:46 -03:00
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
comments ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return CardComments . find (
{ cardId : this . linkedId } ,
{ sort : { createdAt : - 1 } } ,
) ;
2018-04-18 01:35:46 -03:00
} else {
2019-06-28 12:52:09 -05:00
return CardComments . find (
{ cardId : this . _id } ,
{ sort : { createdAt : - 1 } } ,
) ;
2018-04-18 01:35:46 -03:00
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
attachments ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Attachments . find (
2020-05-25 17:54:51 +03:00
{ cardId : this . linkedId } ,
2019-06-28 12:52:09 -05:00
{ sort : { uploadedAt : - 1 } } ,
) ;
2018-04-18 01:35:46 -03:00
} else {
2020-05-25 17:54:51 +03:00
return Attachments . find (
{ cardId : this . _id } ,
2019-06-28 12:52:09 -05:00
{ sort : { uploadedAt : - 1 } } ,
) ;
2018-04-18 01:35:46 -03:00
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ,
2015-09-08 20:19:42 +02:00
2015-09-03 23:12:46 +02:00
cover ( ) {
2020-05-24 11:54:09 +02:00
if ( ! this . coverId ) return false ;
2015-11-16 21:41:49 +01:00
const cover = Attachments . findOne ( this . coverId ) ;
2017-12-03 04:00:55 +02:00
// if we return a cover before it is fully stored, we will get errors when we try to display it
// todo XXX we could return a default "upload pending" image in the meantime?
2020-05-25 17:54:51 +03:00
return cover && cover . url ( ) && cover ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ,
2015-09-08 20:19:42 +02:00
2017-01-20 21:05:48 +08:00
checklists ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Checklists . find ( { cardId : this . linkedId } , { sort : { sort : 1 } } ) ;
2018-04-18 00:59:22 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Checklists . find ( { cardId : this . _id } , { sort : { sort : 1 } } ) ;
2018-04-18 00:59:22 -03:00
}
2017-01-20 21:05:48 +08:00
} ,
checklistItemCount ( ) {
const checklists = this . checklists ( ) . fetch ( ) ;
2019-06-28 12:52:09 -05:00
return checklists
. map ( checklist => {
return checklist . itemCount ( ) ;
} )
. reduce ( ( prev , next ) => {
return prev + next ;
} , 0 ) ;
2017-01-20 21:05:48 +08:00
} ,
checklistFinishedCount ( ) {
const checklists = this . checklists ( ) . fetch ( ) ;
2019-06-28 12:52:09 -05:00
return checklists
. map ( checklist => {
return checklist . finishedCount ( ) ;
} )
. reduce ( ( prev , next ) => {
return prev + next ;
} , 0 ) ;
2017-01-20 21:05:48 +08:00
} ,
checklistFinished ( ) {
2019-06-28 12:52:09 -05:00
return (
this . hasChecklist ( ) &&
this . checklistItemCount ( ) === this . checklistFinishedCount ( )
) ;
2017-01-20 21:05:48 +08:00
} ,
hasChecklist ( ) {
return this . checklistItemCount ( ) !== 0 ;
} ,
2018-06-18 23:25:56 +03:00
subtasks ( ) {
2019-06-28 12:52:09 -05:00
return Cards . find (
{
parentId : this . _id ,
archived : false ,
2018-09-16 01:50:36 +03:00
} ,
2019-06-28 12:52:09 -05:00
{
sort : {
sort : 1 ,
} ,
} ,
) ;
2018-06-23 23:31:44 +03:00
} ,
allSubtasks ( ) {
2019-06-28 12:52:09 -05:00
return Cards . find (
{
parentId : this . _id ,
archived : false ,
2018-09-16 01:50:36 +03:00
} ,
2019-06-28 12:52:09 -05:00
{
sort : {
sort : 1 ,
} ,
} ,
) ;
2018-06-18 23:25:56 +03:00
} ,
subtasksCount ( ) {
2018-06-23 23:31:44 +03:00
return Cards . find ( {
parentId : this . _id ,
archived : false ,
} ) . count ( ) ;
2018-06-18 23:25:56 +03:00
} ,
subtasksFinishedCount ( ) {
2018-06-23 23:31:44 +03:00
return Cards . find ( {
parentId : this . _id ,
2018-09-16 01:50:36 +03:00
archived : true ,
2018-09-14 18:03:57 +02:00
} ) . count ( ) ;
2018-06-18 23:25:56 +03:00
} ,
subtasksFinished ( ) {
const finishCount = this . subtasksFinishedCount ( ) ;
return finishCount > 0 && this . subtasksCount ( ) === finishCount ;
} ,
2018-06-25 23:12:20 +03:00
allowsSubtasks ( ) {
2018-06-18 23:25:56 +03:00
return this . subtasksCount ( ) !== 0 ;
} ,
2017-08-30 03:23:57 +02:00
customFieldIndex ( customFieldId ) {
return _ . pluck ( this . customFields , '_id' ) . indexOf ( customFieldId ) ;
} ,
2017-09-05 02:34:18 +02:00
// customFields with definitions
customFieldsWD ( ) {
// get all definitions
const definitions = CustomFields . find ( {
2019-06-28 12:52:09 -05:00
boardIds : { $in : [ this . boardId ] } ,
2017-09-05 02:34:18 +02:00
} ) . fetch ( ) ;
// match right definition to each field
2018-05-23 11:02:23 +02:00
if ( ! this . customFields ) return [ ] ;
2019-06-28 12:52:09 -05:00
return this . customFields . map ( customField => {
const definition = definitions . find ( definition => {
2018-06-14 11:58:37 +02:00
return definition . _id === customField . _id ;
} ) ;
2019-03-16 22:43:47 +01:00
if ( ! definition ) {
return { } ;
}
2018-06-14 11:58:37 +02:00
//search for "True Value" which is for DropDowns other then the Value (which is the id)
2018-06-14 12:41:16 +02:00
let trueValue = customField . value ;
2019-06-28 12:52:09 -05:00
if (
definition . settings . dropdownItems &&
definition . settings . dropdownItems . length > 0
) {
2018-09-14 18:03:57 +02:00
for ( let i = 0 ; i < definition . settings . dropdownItems . length ; i ++ ) {
if ( definition . settings . dropdownItems [ i ] . _id === customField . value ) {
2018-06-14 11:58:37 +02:00
trueValue = definition . settings . dropdownItems [ i ] . name ;
}
}
}
2017-09-05 02:34:18 +02:00
return {
_id : customField . _id ,
value : customField . value ,
2018-06-14 11:58:37 +02:00
trueValue ,
definition ,
2018-05-18 10:24:51 +02:00
} ;
2017-09-05 02:34:18 +02:00
} ) ;
2018-07-24 18:18:40 +02:00
} ,
2017-09-05 02:34:18 +02:00
2018-07-24 18:18:40 +02:00
colorClass ( ) {
2019-06-28 12:52:09 -05:00
if ( this . color ) return this . color ;
2018-07-24 18:18:40 +02:00
return '' ;
2017-09-05 02:34:18 +02:00
} ,
2015-09-03 23:12:46 +02:00
absoluteUrl ( ) {
const board = this . board ( ) ;
2016-01-05 23:26:02 +08:00
return FlowRouter . url ( 'card' , {
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
boardId : board . _id ,
slug : board . slug ,
2015-09-03 23:12:46 +02:00
cardId : this . _id ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
} ,
2017-10-04 17:48:37 +02:00
canBeRestored ( ) {
2018-09-14 18:03:57 +02:00
const list = Lists . findOne ( {
2018-09-16 01:50:36 +03:00
_id : this . listId ,
2018-09-14 18:03:57 +02:00
} ) ;
2019-06-28 12:52:09 -05:00
if (
! list . getWipLimit ( 'soft' ) &&
list . getWipLimit ( 'enabled' ) &&
list . getWipLimit ( 'value' ) === list . cards ( ) . count ( )
) {
2017-10-04 17:48:37 +02:00
return false ;
}
return true ;
} ,
2018-06-19 01:00:14 +03:00
parentCard ( ) {
if ( this . parentId === '' ) {
return null ;
}
return Cards . findOne ( this . parentId ) ;
} ,
2018-06-26 02:13:31 +03:00
parentCardName ( ) {
2018-06-26 17:39:31 +03:00
let result = '' ;
if ( this . parentId !== '' ) {
const card = Cards . findOne ( this . parentId ) ;
if ( card ) {
result = card . title ;
}
2018-06-26 02:13:31 +03:00
}
2018-06-26 17:39:31 +03:00
return result ;
2018-06-26 02:13:31 +03:00
} ,
parentListId ( ) {
const result = [ ] ;
let crtParentId = this . parentId ;
while ( crtParentId !== '' ) {
const crt = Cards . findOne ( crtParentId ) ;
2019-06-28 12:52:09 -05:00
if ( crt === null || crt === undefined ) {
2018-06-26 02:13:31 +03:00
// maybe it has been deleted
break ;
}
if ( crtParentId in result ) {
// circular reference
break ;
}
result . unshift ( crtParentId ) ;
crtParentId = crt . parentId ;
}
return result ;
} ,
parentList ( ) {
const resultId = [ ] ;
const result = [ ] ;
let crtParentId = this . parentId ;
while ( crtParentId !== '' ) {
const crt = Cards . findOne ( crtParentId ) ;
2019-06-28 12:52:09 -05:00
if ( crt === null || crt === undefined ) {
2018-06-26 02:13:31 +03:00
// maybe it has been deleted
break ;
}
if ( crtParentId in resultId ) {
// circular reference
break ;
}
resultId . unshift ( crtParentId ) ;
result . unshift ( crt ) ;
crtParentId = crt . parentId ;
}
return result ;
} ,
parentString ( sep ) {
2019-06-28 12:52:09 -05:00
return this . parentList ( )
. map ( function ( elem ) {
return elem . title ;
} )
. join ( sep ) ;
2018-06-26 02:13:31 +03:00
} ,
2018-06-19 01:00:14 +03:00
isTopLevel ( ) {
return this . parentId === '' ;
} ,
2018-04-16 16:38:20 -03:00
2018-05-02 14:20:55 -03:00
isLinkedCard ( ) {
return this . type === 'cardType-linkedCard' ;
2018-04-16 16:38:20 -03:00
} ,
2018-05-02 14:20:55 -03:00
isLinkedBoard ( ) {
return this . type === 'cardType-linkedBoard' ;
2018-04-16 16:38:20 -03:00
} ,
2018-05-02 14:20:55 -03:00
isLinked ( ) {
return this . isLinkedCard ( ) || this . isLinkedBoard ( ) ;
2018-04-16 16:38:20 -03:00
} ,
2018-04-17 01:55:57 -03:00
setDescription ( description ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { description } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { description } } ) ;
2018-04-17 01:55:57 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { description } } ) ;
2018-04-17 01:55:57 -03:00
}
} ,
2018-04-16 16:38:20 -03:00
getDescription ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( { _id : this . linkedId } ) ;
if ( card && card . description ) return card . description ;
else return null ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
if ( board && board . description ) return board . description ;
else return null ;
2018-04-18 02:37:20 -03:00
} else if ( this . description ) {
return this . description ;
2018-04-16 16:38:20 -03:00
} else {
2018-04-18 02:37:20 -03:00
return null ;
2018-04-16 16:38:20 -03:00
}
} ,
2018-04-17 01:55:57 -03:00
getMembers ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 01:55:57 -03:00
return card . members ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
return board . activeMembers ( ) . map ( member => {
2018-04-17 01:55:57 -03:00
return member . userId ;
} ) ;
} else {
return this . members ;
}
} ,
2019-10-31 02:21:50 +02:00
getAssignees ( ) {
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
return card . assignees ;
} else if ( this . isLinkedBoard ( ) ) {
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2019-11-02 16:12:40 +02:00
return board . activeMembers ( ) . map ( assignee => {
2019-10-31 02:21:50 +02:00
return assignee . userId ;
} ) ;
} else {
return this . assignees ;
}
} ,
2018-04-17 01:55:57 -03:00
assignMember ( memberId ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2018-04-17 01:55:57 -03:00
return Cards . update (
2018-05-02 14:20:55 -03:00
{ _id : this . linkedId } ,
2019-06-28 12:52:09 -05:00
{ $addToSet : { members : memberId } } ,
2018-04-17 01:55:57 -03:00
) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 01:55:57 -03:00
return board . addMember ( memberId ) ;
} else {
return Cards . update (
{ _id : this . _id } ,
2019-06-28 12:52:09 -05:00
{ $addToSet : { members : memberId } } ,
2018-04-17 01:55:57 -03:00
) ;
}
} ,
2019-10-31 02:21:50 +02:00
assignAssignee ( assigneeId ) {
if ( this . isLinkedCard ( ) ) {
return Cards . update (
{ _id : this . linkedId } ,
{ $addToSet : { assignees : assigneeId } } ,
) ;
} else if ( this . isLinkedBoard ( ) ) {
const board = Boards . findOne ( { _id : this . linkedId } ) ;
return board . addAssignee ( assigneeId ) ;
} else {
return Cards . update (
{ _id : this . _id } ,
{ $addToSet : { assignees : assigneeId } } ,
) ;
}
} ,
2018-04-17 01:55:57 -03:00
unassignMember ( memberId ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2018-04-17 01:55:57 -03:00
return Cards . update (
2018-05-02 14:20:55 -03:00
{ _id : this . linkedId } ,
2019-06-28 12:52:09 -05:00
{ $pull : { members : memberId } } ,
2018-04-17 01:55:57 -03:00
) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 01:55:57 -03:00
return board . removeMember ( memberId ) ;
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $pull : { members : memberId } } ) ;
2018-04-17 01:55:57 -03:00
}
} ,
2019-10-31 02:21:50 +02:00
unassignAssignee ( assigneeId ) {
if ( this . isLinkedCard ( ) ) {
return Cards . update (
{ _id : this . linkedId } ,
{ $pull : { assignees : assigneeId } } ,
) ;
} else if ( this . isLinkedBoard ( ) ) {
const board = Boards . findOne ( { _id : this . linkedId } ) ;
return board . removeAssignee ( assigneeId ) ;
} else {
return Cards . update (
{ _id : this . _id } ,
{ $pull : { assignees : assigneeId } } ,
) ;
}
} ,
2018-04-17 01:55:57 -03:00
toggleMember ( memberId ) {
if ( this . getMembers ( ) && this . getMembers ( ) . indexOf ( memberId ) > - 1 ) {
return this . unassignMember ( memberId ) ;
} else {
return this . assignMember ( memberId ) ;
}
} ,
2018-04-17 23:17:44 -03:00
2019-10-31 02:21:50 +02:00
toggleAssignee ( assigneeId ) {
if ( this . getAssignees ( ) && this . getAssignees ( ) . indexOf ( assigneeId ) > - 1 ) {
return this . unassignAssignee ( assigneeId ) ;
} else {
return this . assignAssignee ( assigneeId ) ;
}
} ,
2018-04-17 23:17:44 -03:00
getReceived ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return card . receivedAt ;
} else {
return this . receivedAt ;
}
} ,
setReceived ( receivedAt ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { receivedAt } } ) ;
2018-04-17 23:17:44 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { receivedAt } } ) ;
2018-04-17 23:17:44 -03:00
}
} ,
getStart ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return card . startAt ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-18 02:37:20 -03:00
return board . startAt ;
2018-04-17 23:17:44 -03:00
} else {
return this . startAt ;
}
} ,
setStart ( startAt ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { startAt } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { startAt } } ) ;
2018-04-17 23:17:44 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { startAt } } ) ;
2018-04-17 23:17:44 -03:00
}
} ,
getDue ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return card . dueAt ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-18 02:37:20 -03:00
return board . dueAt ;
2018-04-17 23:17:44 -03:00
} else {
return this . dueAt ;
}
} ,
setDue ( dueAt ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { dueAt } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { dueAt } } ) ;
2018-04-17 23:17:44 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { dueAt } } ) ;
2018-04-17 23:17:44 -03:00
}
} ,
getEnd ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return card . endAt ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return board . endAt ;
} else {
return this . endAt ;
}
} ,
setEnd ( endAt ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { endAt } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { endAt } } ) ;
2018-04-17 23:17:44 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { endAt } } ) ;
2018-04-17 23:17:44 -03:00
}
} ,
getIsOvertime ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return card . isOvertime ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return board . isOvertime ;
} else {
return this . isOvertime ;
}
} ,
setIsOvertime ( isOvertime ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { isOvertime } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { isOvertime } } ) ;
2018-04-17 23:17:44 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { isOvertime } } ) ;
2018-04-17 23:17:44 -03:00
}
} ,
getSpentTime ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return card . spentTime ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-17 23:17:44 -03:00
return board . spentTime ;
} else {
return this . spentTime ;
}
} ,
setSpentTime ( spentTime ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { spentTime } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { spentTime } } ) ;
2018-04-17 23:17:44 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { spentTime } } ) ;
2018-04-17 23:17:44 -03:00
}
} ,
2018-04-18 02:30:24 -03:00
2020-04-07 20:43:35 +02:00
getVoteQuestion ( ) {
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
if ( card && card . vote ) return card . vote . question ;
else return null ;
} else if ( this . isLinkedBoard ( ) ) {
const board = Boards . findOne ( { _id : this . linkedId } ) ;
if ( board && board . vote ) return board . vote . question ;
else return null ;
} else if ( this . vote ) {
return this . vote . question ;
} else {
return null ;
}
} ,
2020-04-10 01:46:36 +02:00
getVotePublic ( ) {
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
if ( card && card . vote ) return card . vote . public ;
else return null ;
} else if ( this . isLinkedBoard ( ) ) {
const board = Boards . findOne ( { _id : this . linkedId } ) ;
if ( board && board . vote ) return board . vote . public ;
else return null ;
} else if ( this . vote ) {
return this . vote . public ;
} else {
return null ;
}
} ,
2020-05-03 00:33:15 +02:00
getVoteEnd ( ) {
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
if ( card && card . vote ) return card . vote . end ;
else return null ;
} else if ( this . isLinkedBoard ( ) ) {
const board = Boards . findOne ( { _id : this . linkedId } ) ;
if ( board && board . vote ) return board . vote . end ;
else return null ;
} else if ( this . vote ) {
return this . vote . end ;
} else {
return null ;
}
} ,
expiredVote ( ) {
let end = this . getVoteEnd ( ) ;
if ( end ) {
end = moment ( end ) ;
return end . isBefore ( new Date ( ) ) ;
}
return false ;
} ,
2020-04-10 01:46:36 +02:00
voteMemberPositive ( ) {
if ( this . vote && this . vote . positive )
2020-04-22 21:00:31 +03:00
return Users . find ( { _id : { $in : this . vote . positive } } ) ;
return [ ] ;
2020-04-10 01:46:36 +02:00
} ,
2020-04-28 03:24:18 +03:00
2020-04-10 01:46:36 +02:00
voteMemberNegative ( ) {
if ( this . vote && this . vote . negative )
2020-04-22 21:00:31 +03:00
return Users . find ( { _id : { $in : this . vote . negative } } ) ;
return [ ] ;
2020-04-10 01:46:36 +02:00
} ,
2020-06-11 19:52:44 +02:00
voteState ( ) {
const userId = Meteor . userId ( ) ;
let state ;
if ( this . vote ) {
if ( this . vote . positive ) {
state = _ . contains ( this . vote . positive , userId ) ;
if ( state === true ) return true ;
}
if ( this . vote . negative ) {
state = _ . contains ( this . vote . negative , userId ) ;
if ( state === true ) return false ;
}
}
return null ;
} ,
2020-04-10 01:46:36 +02:00
2018-08-21 22:20:45 +02:00
getId ( ) {
if ( this . isLinked ( ) ) {
return this . linkedId ;
} else {
return this . _id ;
}
} ,
2018-04-18 02:30:24 -03:00
getTitle ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-18 02:30:24 -03:00
return card . title ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-18 02:30:24 -03:00
return board . title ;
} else {
return this . title ;
}
} ,
2018-04-21 00:14:10 -03:00
getBoardTitle ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-21 00:14:10 -03:00
const board = Boards . findOne ( { _id : card . boardId } ) ;
return board . title ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-21 00:14:10 -03:00
return board . title ;
} else {
const board = Boards . findOne ( { _id : this . boardId } ) ;
return board . title ;
}
} ,
2018-04-18 02:30:24 -03:00
setTitle ( title ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { title } } ) ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
return Boards . update ( { _id : this . linkedId } , { $set : { title } } ) ;
2018-04-18 02:30:24 -03:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { title } } ) ;
2018-04-18 02:30:24 -03:00
}
} ,
2018-04-20 23:52:13 -03:00
getArchived ( ) {
2018-05-02 14:20:55 -03:00
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
2018-04-20 23:52:13 -03:00
return card . archived ;
2018-05-02 14:20:55 -03:00
} else if ( this . isLinkedBoard ( ) ) {
2019-06-28 12:52:09 -05:00
const board = Boards . findOne ( { _id : this . linkedId } ) ;
2018-04-20 23:52:13 -03:00
return board . archived ;
} else {
return this . archived ;
}
} ,
2018-08-15 20:50:51 +02:00
setRequestedBy ( requestedBy ) {
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { requestedBy } } ) ;
2018-08-15 20:50:51 +02:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { requestedBy } } ) ;
2018-08-15 20:50:51 +02:00
}
} ,
getRequestedBy ( ) {
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
return card . requestedBy ;
2019-06-28 12:52:09 -05:00
} else {
2018-08-15 20:50:51 +02:00
return this . requestedBy ;
}
} ,
setAssignedBy ( assignedBy ) {
if ( this . isLinkedCard ( ) ) {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . linkedId } , { $set : { assignedBy } } ) ;
2018-08-15 20:50:51 +02:00
} else {
2019-06-28 12:52:09 -05:00
return Cards . update ( { _id : this . _id } , { $set : { assignedBy } } ) ;
2018-08-15 20:50:51 +02:00
}
} ,
getAssignedBy ( ) {
if ( this . isLinkedCard ( ) ) {
const card = Cards . findOne ( { _id : this . linkedId } ) ;
return card . assignedBy ;
2019-06-28 12:52:09 -05:00
} else {
2018-08-15 20:50:51 +02:00
return this . assignedBy ;
}
} ,
2019-02-22 22:59:19 +01:00
isTemplateCard ( ) {
return this . type === 'template-card' ;
} ,
2020-05-03 00:33:15 +02:00
votePublic ( ) {
if ( this . vote ) return this . vote . public ;
return null ;
} ,
voteAllowNonBoardMembers ( ) {
if ( this . vote ) return this . vote . allowNonBoardMembers ;
return null ;
} ,
voteCountNegative ( ) {
if ( this . vote && this . vote . negative ) return this . vote . negative . length ;
return null ;
} ,
voteCountPositive ( ) {
if ( this . vote && this . vote . positive ) return this . vote . positive . length ;
return null ;
} ,
voteCount ( ) {
return this . voteCountPositive ( ) + this . voteCountNegative ( ) ;
} ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
2015-09-08 20:19:42 +02:00
Cards . mutations ( {
2018-06-24 17:47:57 +03:00
applyToChildren ( funct ) {
2018-09-14 18:03:57 +02:00
Cards . find ( {
2018-09-16 01:50:36 +03:00
parentId : this . _id ,
2019-06-28 12:52:09 -05:00
} ) . forEach ( card => {
2018-06-19 01:00:14 +03:00
funct ( card ) ;
} ) ;
} ,
2015-09-08 20:19:42 +02:00
archive ( ) {
2019-06-28 12:52:09 -05:00
this . applyToChildren ( card => {
2018-09-14 18:03:57 +02:00
return card . archive ( ) ;
} ) ;
return {
$set : {
2018-09-16 01:50:36 +03:00
archived : true ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
restore ( ) {
2019-06-28 12:52:09 -05:00
this . applyToChildren ( card => {
2018-09-14 18:03:57 +02:00
return card . restore ( ) ;
} ) ;
return {
$set : {
2018-09-16 01:50:36 +03:00
archived : false ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
2020-05-25 21:01:51 +02:00
moveToEndOfList ( { listId } = { } ) {
let swimlaneId = this . swimlaneId ;
const boardId = this . boardId ;
let sortIndex = 0 ;
// This should never happen, but there was a bug that was fixed in commit
// ea0239538a68e225c867411a4f3e0d27c158383.
if ( ! swimlaneId ) {
const board = Boards . findOne ( boardId ) ;
swimlaneId = board . getDefaultSwimline ( ) . _id ;
}
// Move the minicard to the end of the target list
let parentElementDom = $ ( ` #swimlane- ${ this . swimlaneId } ` ) . get ( 0 ) ;
if ( ! parentElementDom ) parentElementDom = $ ( ':root' ) ;
const lastCardDom = $ ( parentElementDom )
. find ( ` #js-list- ${ listId } .js-minicard:last ` )
. get ( 0 ) ;
if ( lastCardDom ) sortIndex = Utils . calculateIndex ( lastCardDom , null ) . base ;
return this . moveOptionalArgs ( {
2020-05-27 11:13:09 +02:00
boardId ,
swimlaneId ,
listId ,
2020-05-25 21:01:51 +02:00
sort : sortIndex ,
} ) ;
} ,
moveOptionalArgs ( { boardId , swimlaneId , listId , sort } = { } ) {
2020-05-25 23:05:36 +02:00
boardId = boardId || this . boardId ;
swimlaneId = swimlaneId || this . swimlaneId ;
2020-05-25 21:01:51 +02:00
// This should never happen, but there was a bug that was fixed in commit
// ea0239538a68e225c867411a4f3e0d27c158383.
if ( ! swimlaneId ) {
const board = Boards . findOne ( boardId ) ;
swimlaneId = board . getDefaultSwimline ( ) . _id ;
}
2020-05-25 23:05:36 +02:00
listId = listId || this . listId ;
2020-05-27 11:13:09 +02:00
if ( sort === undefined || sort === null ) sort = this . sort ;
2020-05-25 21:01:51 +02:00
return this . move ( boardId , swimlaneId , listId , sort ) ;
} ,
2019-03-16 22:43:47 +01:00
move ( boardId , swimlaneId , listId , sort ) {
2020-06-05 08:29:46 +02:00
const mutatedFields = {
boardId ,
swimlaneId ,
listId ,
sort ,
} ;
// we must only copy the labels and custom fields if the target board
// differs from the source board
2019-03-16 22:43:47 +01:00
if ( this . boardId !== boardId ) {
2020-06-05 08:29:46 +02:00
// Get label names
const oldBoard = Boards . findOne ( this . boardId ) ;
const oldBoardLabels = oldBoard . labels ;
const oldCardLabels = _ . pluck (
_ . filter ( oldBoardLabels , label => {
return _ . contains ( this . labelIds , label . _id ) ;
} ) ,
'name' ,
) ;
const newBoard = Boards . findOne ( boardId ) ;
const newBoardLabels = newBoard . labels ;
const newCardLabelIds = _ . pluck (
_ . filter ( newBoardLabels , label => {
return label . name && _ . contains ( oldCardLabels , label . name ) ;
} ) ,
'_id' ,
) ;
Object . assign ( mutatedFields , {
labelIds : newCardLabelIds ,
} ) ;
// Copy custom fields
2019-03-16 22:43:47 +01:00
CustomFields . find ( {
2019-06-28 12:52:09 -05:00
_id : {
$in : this . customFields . map ( cf => {
return cf . _id ;
} ) ,
} ,
} ) . forEach ( cf => {
if ( ! _ . contains ( cf . boardIds , boardId ) ) cf . addBoard ( boardId ) ;
2019-03-16 22:43:47 +01:00
} ) ;
}
Cards . update ( this . _id , {
2018-09-16 01:50:36 +03:00
$set : mutatedFields ,
2019-03-16 22:43:47 +01:00
} ) ;
2015-09-08 20:19:42 +02:00
} ,
addLabel ( labelId ) {
2018-09-14 18:03:57 +02:00
return {
$addToSet : {
2018-09-16 01:50:36 +03:00
labelIds : labelId ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
removeLabel ( labelId ) {
2018-09-14 18:03:57 +02:00
return {
$pull : {
2018-09-16 01:50:36 +03:00
labelIds : labelId ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
toggleLabel ( labelId ) {
if ( this . labelIds && this . labelIds . indexOf ( labelId ) > - 1 ) {
return this . removeLabel ( labelId ) ;
} else {
return this . addLabel ( labelId ) ;
}
} ,
2019-01-22 10:35:09 +01:00
setColor ( newColor ) {
if ( newColor === 'white' ) {
newColor = null ;
}
return {
$set : {
color : newColor ,
} ,
} ;
} ,
2015-09-08 20:19:42 +02:00
assignMember ( memberId ) {
2018-09-14 18:03:57 +02:00
return {
$addToSet : {
2018-09-16 01:50:36 +03:00
members : memberId ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
2019-10-31 02:21:50 +02:00
assignAssignee ( assigneeId ) {
2019-11-06 23:36:43 +02:00
// If there is not any assignee, allow one assignee, not more.
if ( this . getAssignees ( ) . length === 0 ) {
return {
$addToSet : {
assignees : assigneeId ,
} ,
} ;
2019-11-07 00:04:05 +02:00
} else {
return false ;
2019-11-06 23:36:43 +02:00
}
2019-10-31 02:21:50 +02:00
} ,
2015-09-08 20:19:42 +02:00
unassignMember ( memberId ) {
2018-09-14 18:03:57 +02:00
return {
$pull : {
2018-09-16 01:50:36 +03:00
members : memberId ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
2019-10-31 02:21:50 +02:00
unassignAssignee ( assigneeId ) {
return {
$pull : {
assignees : assigneeId ,
} ,
} ;
} ,
2015-09-08 20:19:42 +02:00
toggleMember ( memberId ) {
if ( this . members && this . members . indexOf ( memberId ) > - 1 ) {
return this . unassignMember ( memberId ) ;
} else {
return this . assignMember ( memberId ) ;
}
} ,
2019-10-31 02:21:50 +02:00
toggleAssignee ( assigneeId ) {
if ( this . assignees && this . assignees . indexOf ( assigneeId ) > - 1 ) {
return this . unassignAssignee ( assigneeId ) ;
} else {
return this . assignAssignee ( assigneeId ) ;
}
} ,
2017-08-30 02:54:54 +02:00
assignCustomField ( customFieldId ) {
2018-09-14 18:03:57 +02:00
return {
$addToSet : {
customFields : {
_id : customFieldId ,
2018-09-16 01:50:36 +03:00
value : null ,
} ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2017-08-30 02:54:54 +02:00
} ,
unassignCustomField ( customFieldId ) {
2018-09-14 18:03:57 +02:00
return {
$pull : {
customFields : {
2018-09-16 01:50:36 +03:00
_id : customFieldId ,
} ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2017-08-30 02:54:54 +02:00
} ,
toggleCustomField ( customFieldId ) {
2017-08-30 03:23:57 +02:00
if ( this . customFields && this . customFieldIndex ( customFieldId ) > - 1 ) {
2017-08-30 02:54:54 +02:00
return this . unassignCustomField ( customFieldId ) ;
} else {
return this . assignCustomField ( customFieldId ) ;
}
} ,
2017-09-14 00:50:05 +02:00
setCustomField ( customFieldId , value ) {
// todo
const index = this . customFieldIndex ( customFieldId ) ;
if ( index > - 1 ) {
2018-09-14 18:03:57 +02:00
const update = {
2018-09-16 01:50:36 +03:00
$set : { } ,
2018-09-14 18:03:57 +02:00
} ;
2018-05-18 10:43:43 +02:00
update . $set [ ` customFields. ${ index } .value ` ] = value ;
2017-09-14 00:50:05 +02:00
return update ;
}
2018-05-18 10:24:51 +02:00
// TODO
// Ignatz 18.05.2018: Return null to silence ESLint. No Idea if that is correct
return null ;
2017-09-14 00:50:05 +02:00
} ,
2015-09-08 20:19:42 +02:00
setCover ( coverId ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
coverId ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-08 20:19:42 +02:00
} ,
unsetCover ( ) {
2018-09-14 18:03:57 +02:00
return {
$unset : {
2018-09-16 01:50:36 +03:00
coverId : '' ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-03 23:12:46 +02:00
} ,
2016-01-29 21:10:22 +01:00
2018-03-26 19:04:02 +00:00
setReceived ( receivedAt ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
receivedAt ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2018-03-26 19:04:02 +00:00
} ,
unsetReceived ( ) {
2018-09-14 18:03:57 +02:00
return {
$unset : {
2018-09-16 01:50:36 +03:00
receivedAt : '' ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2018-03-26 19:04:02 +00:00
} ,
2016-01-29 21:10:22 +01:00
setStart ( startAt ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
startAt ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2016-01-29 21:10:22 +01:00
} ,
unsetStart ( ) {
2018-09-14 18:03:57 +02:00
return {
$unset : {
2018-09-16 01:50:36 +03:00
startAt : '' ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2016-01-29 21:10:22 +01:00
} ,
setDue ( dueAt ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
dueAt ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2015-09-03 23:12:46 +02:00
} ,
2016-01-29 21:10:22 +01:00
unsetDue ( ) {
2018-09-14 18:03:57 +02:00
return {
$unset : {
2018-09-16 01:50:36 +03:00
dueAt : '' ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2016-01-29 21:10:22 +01:00
} ,
2017-11-20 22:26:31 +07:00
2018-03-26 19:04:02 +00:00
setEnd ( endAt ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
endAt ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2018-03-26 19:04:02 +00:00
} ,
unsetEnd ( ) {
2018-09-14 18:03:57 +02:00
return {
$unset : {
2018-09-16 01:50:36 +03:00
endAt : '' ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2018-03-26 19:04:02 +00:00
} ,
2017-11-20 22:26:31 +07:00
setOvertime ( isOvertime ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
isOvertime ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2017-11-20 22:26:31 +07:00
} ,
setSpentTime ( spentTime ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
spentTime ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2017-11-20 22:26:31 +07:00
} ,
unsetSpentTime ( ) {
2018-09-14 18:03:57 +02:00
return {
$unset : {
spentTime : '' ,
2018-09-16 01:50:36 +03:00
isOvertime : false ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2017-11-20 22:26:31 +07:00
} ,
2018-06-26 17:39:31 +03:00
setParentId ( parentId ) {
2018-09-14 18:03:57 +02:00
return {
$set : {
2018-09-16 01:50:36 +03:00
parentId ,
} ,
2018-09-14 18:03:57 +02:00
} ;
2018-06-26 17:39:31 +03:00
} ,
2020-05-03 00:33:15 +02:00
setVoteQuestion ( question , publicVote , allowNonBoardMembers ) {
2020-04-07 20:43:35 +02:00
return {
$set : {
vote : {
question ,
2020-04-28 03:24:18 +03:00
public : publicVote ,
2020-05-03 00:33:15 +02:00
allowNonBoardMembers ,
2020-04-08 23:16:48 +03:00
positive : [ ] ,
negative : [ ] ,
2020-04-07 20:43:35 +02:00
} ,
2020-04-08 23:16:48 +03:00
} ,
} ;
2020-04-07 20:43:35 +02:00
} ,
unsetVote ( ) {
return {
$unset : {
vote : '' ,
} ,
} ;
} ,
2020-05-03 00:33:15 +02:00
setVoteEnd ( end ) {
return {
$set : { 'vote.end' : end } ,
} ;
} ,
unsetVoteEnd ( ) {
return {
$unset : { 'vote.end' : '' } ,
} ;
} ,
2020-04-07 20:43:35 +02:00
setVote ( userId , forIt ) {
switch ( forIt ) {
case true :
// vote for it
return {
2020-04-08 23:16:48 +03:00
$pull : {
'vote.negative' : userId ,
2020-04-07 20:43:35 +02:00
} ,
$addToSet : {
2020-04-08 23:16:48 +03:00
'vote.positive' : userId ,
} ,
} ;
2020-04-07 20:43:35 +02:00
case false :
// vote against
return {
2020-04-08 23:16:48 +03:00
$pull : {
'vote.positive' : userId ,
2020-04-07 20:43:35 +02:00
} ,
$addToSet : {
2020-04-08 23:16:48 +03:00
'vote.negative' : userId ,
} ,
} ;
2020-04-07 20:43:35 +02:00
default :
// Remove votes
return {
2020-04-08 23:16:48 +03:00
$pull : {
'vote.positive' : userId ,
'vote.negative' : userId ,
2020-04-07 20:43:35 +02:00
} ,
2020-04-08 23:16:48 +03:00
} ;
2020-04-07 20:43:35 +02:00
}
} ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
2017-07-19 10:27:23 +02:00
//FUNCTIONS FOR creation of Activities
2019-03-16 22:43:47 +01:00
function updateActivities ( doc , fieldNames , modifier ) {
if ( _ . contains ( fieldNames , 'labelIds' ) && _ . contains ( fieldNames , 'boardId' ) ) {
Activities . find ( {
activityType : 'addedLabel' ,
cardId : doc . _id ,
2019-06-28 12:52:09 -05:00
} ) . forEach ( a => {
2019-03-16 22:43:47 +01:00
const lidx = doc . labelIds . indexOf ( a . labelId ) ;
if ( lidx !== - 1 && modifier . $set . labelIds . length > lidx ) {
Activities . update ( a . _id , {
$set : {
labelId : modifier . $set . labelIds [ doc . labelIds . indexOf ( a . labelId ) ] ,
boardId : modifier . $set . boardId ,
2019-03-16 23:15:30 +01:00
} ,
2019-03-16 22:43:47 +01:00
} ) ;
} else {
Activities . remove ( a . _id ) ;
}
} ) ;
} else if ( _ . contains ( fieldNames , 'boardId' ) ) {
Activities . remove ( {
activityType : 'addedLabel' ,
cardId : doc . _id ,
} ) ;
}
}
2019-06-28 12:52:09 -05:00
function cardMove (
userId ,
doc ,
fieldNames ,
oldListId ,
oldSwimlaneId ,
oldBoardId ,
) {
if ( _ . contains ( fieldNames , 'boardId' ) && doc . boardId !== oldBoardId ) {
2019-03-16 22:43:47 +01:00
Activities . insert ( {
userId ,
activityType : 'moveCardBoard' ,
boardName : Boards . findOne ( doc . boardId ) . title ,
boardId : doc . boardId ,
oldBoardId ,
oldBoardName : Boards . findOne ( oldBoardId ) . title ,
cardId : doc . _id ,
swimlaneName : Swimlanes . findOne ( doc . swimlaneId ) . title ,
swimlaneId : doc . swimlaneId ,
oldSwimlaneId ,
} ) ;
2019-06-28 12:52:09 -05:00
} else if (
( _ . contains ( fieldNames , 'listId' ) && doc . listId !== oldListId ) ||
( _ . contains ( fieldNames , 'swimlaneId' ) && doc . swimlaneId !== oldSwimlaneId )
) {
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
Activities . insert ( {
2015-09-03 23:12:46 +02:00
userId ,
2017-07-19 10:27:23 +02:00
oldListId ,
activityType : 'moveCard' ,
2018-09-14 18:03:57 +02:00
listName : Lists . findOne ( doc . listId ) . title ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
listId : doc . listId ,
2017-07-19 10:27:23 +02:00
boardId : doc . boardId ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
cardId : doc . _id ,
2019-06-28 12:52:09 -05:00
cardTitle : doc . title ,
2018-12-30 22:08:34 +01:00
swimlaneName : Swimlanes . findOne ( doc . swimlaneId ) . title ,
2018-09-06 00:17:45 +02:00
swimlaneId : doc . swimlaneId ,
oldSwimlaneId ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
2017-07-19 10:27:23 +02:00
}
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
2017-07-19 10:27:23 +02:00
function cardState ( userId , doc , fieldNames ) {
if ( _ . contains ( fieldNames , 'archived' ) ) {
if ( doc . archived ) {
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
Activities . insert ( {
2015-09-03 23:12:46 +02:00
userId ,
2017-07-19 10:27:23 +02:00
activityType : 'archivedCard' ,
2018-09-14 18:03:57 +02:00
listName : Lists . findOne ( doc . listId ) . title ,
2017-07-19 10:27:23 +02:00
boardId : doc . boardId ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
listId : doc . listId ,
2017-07-19 10:27:23 +02:00
cardId : doc . _id ,
2019-04-06 12:45:31 +03:00
swimlaneId : doc . swimlaneId ,
2017-07-19 10:27:23 +02:00
} ) ;
} else {
Activities . insert ( {
userId ,
activityType : 'restoredCard' ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
boardId : doc . boardId ,
2018-09-14 18:03:57 +02:00
listName : Lists . findOne ( doc . listId ) . title ,
2017-07-19 10:27:23 +02:00
listId : doc . listId ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
cardId : doc . _id ,
2019-04-06 12:45:31 +03:00
swimlaneId : doc . swimlaneId ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
}
2017-07-19 10:27:23 +02:00
}
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
2017-07-19 10:27:23 +02:00
function cardMembers ( userId , doc , fieldNames , modifier ) {
2019-06-28 12:52:09 -05:00
if ( ! _ . contains ( fieldNames , 'members' ) ) return ;
2017-07-19 10:27:23 +02:00
let memberId ;
2017-12-03 04:00:55 +02:00
// Say hello to the new member
2017-07-19 10:27:23 +02:00
if ( modifier . $addToSet && modifier . $addToSet . members ) {
memberId = modifier . $addToSet . members ;
2018-09-21 20:19:47 +02:00
const username = Users . findOne ( memberId ) . username ;
2017-07-19 10:27:23 +02:00
if ( ! _ . contains ( doc . members , memberId ) ) {
Activities . insert ( {
userId ,
2018-09-21 14:53:04 +02:00
username ,
2017-07-19 10:27:23 +02:00
activityType : 'joinMember' ,
boardId : doc . boardId ,
cardId : doc . _id ,
2019-03-28 19:38:02 -05:00
memberId ,
listId : doc . listId ,
swimlaneId : doc . swimlaneId ,
2017-07-19 10:27:23 +02:00
} ) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
}
2017-07-19 10:27:23 +02:00
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
2017-12-03 04:00:55 +02:00
// Say goodbye to the former member
2017-07-19 10:27:23 +02:00
if ( modifier . $pull && modifier . $pull . members ) {
memberId = modifier . $pull . members ;
2018-09-21 20:19:47 +02:00
const username = Users . findOne ( memberId ) . username ;
2017-12-03 04:00:55 +02:00
// Check that the former member is member of the card
2017-07-19 10:27:23 +02:00
if ( _ . contains ( doc . members , memberId ) ) {
Activities . insert ( {
userId ,
2018-09-21 14:53:04 +02:00
username ,
2017-07-19 10:27:23 +02:00
activityType : 'unjoinMember' ,
boardId : doc . boardId ,
cardId : doc . _id ,
2019-04-05 02:59:35 +02:00
memberId ,
listId : doc . listId ,
swimlaneId : doc . swimlaneId ,
2017-07-19 10:27:23 +02:00
} ) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
}
2017-07-19 10:27:23 +02:00
}
}
2019-10-31 02:21:50 +02:00
function cardAssignees ( userId , doc , fieldNames , modifier ) {
if ( ! _ . contains ( fieldNames , 'assignees' ) ) return ;
let assigneeId ;
// Say hello to the new assignee
if ( modifier . $addToSet && modifier . $addToSet . assignees ) {
assigneeId = modifier . $addToSet . assignees ;
const username = Users . findOne ( assigneeId ) . username ;
if ( ! _ . contains ( doc . assignees , assigneeId ) ) {
Activities . insert ( {
userId ,
username ,
activityType : 'joinAssignee' ,
boardId : doc . boardId ,
cardId : doc . _id ,
assigneeId ,
listId : doc . listId ,
swimlaneId : doc . swimlaneId ,
} ) ;
}
}
// Say goodbye to the former assignee
if ( modifier . $pull && modifier . $pull . assignees ) {
assigneeId = modifier . $pull . assignees ;
const username = Users . findOne ( assigneeId ) . username ;
// Check that the former assignee is assignee of the card
if ( _ . contains ( doc . assignees , assigneeId ) ) {
Activities . insert ( {
userId ,
username ,
activityType : 'unjoinAssignee' ,
boardId : doc . boardId ,
cardId : doc . _id ,
assigneeId ,
listId : doc . listId ,
swimlaneId : doc . swimlaneId ,
} ) ;
}
}
}
2018-08-16 16:54:29 +02:00
function cardLabels ( userId , doc , fieldNames , modifier ) {
2019-06-28 12:52:09 -05:00
if ( ! _ . contains ( fieldNames , 'labelIds' ) ) return ;
2018-08-16 16:54:29 +02:00
let labelId ;
// Say hello to the new label
if ( modifier . $addToSet && modifier . $addToSet . labelIds ) {
labelId = modifier . $addToSet . labelIds ;
if ( ! _ . contains ( doc . labelIds , labelId ) ) {
const act = {
userId ,
labelId ,
activityType : 'addedLabel' ,
boardId : doc . boardId ,
cardId : doc . _id ,
2019-04-06 12:45:31 +03:00
listId : doc . listId ,
swimlaneId : doc . swimlaneId ,
2018-09-16 01:50:36 +03:00
} ;
2018-08-16 16:54:29 +02:00
Activities . insert ( act ) ;
}
}
// Say goodbye to the label
if ( modifier . $pull && modifier . $pull . labelIds ) {
labelId = modifier . $pull . labelIds ;
// Check that the former member is member of the card
if ( _ . contains ( doc . labelIds , labelId ) ) {
Activities . insert ( {
userId ,
labelId ,
activityType : 'removedLabel' ,
boardId : doc . boardId ,
cardId : doc . _id ,
2019-04-06 12:45:31 +03:00
listId : doc . listId ,
swimlaneId : doc . swimlaneId ,
2018-08-16 16:54:29 +02:00
} ) ;
}
}
}
2019-03-08 11:28:21 +01:00
function cardCustomFields ( userId , doc , fieldNames , modifier ) {
2019-06-28 12:52:09 -05:00
if ( ! _ . contains ( fieldNames , 'customFields' ) ) return ;
2019-03-08 11:28:21 +01:00
// Say hello to the new customField value
if ( modifier . $set ) {
_ . each ( modifier . $set , ( value , key ) => {
if ( key . startsWith ( 'customFields' ) ) {
const dotNotation = key . split ( '.' ) ;
// only individual changes are registered
if ( dotNotation . length > 1 ) {
2019-03-11 10:12:19 +01:00
const customFieldId = doc . customFields [ dotNotation [ 1 ] ] . _id ;
2019-03-08 11:28:21 +01:00
const act = {
userId ,
customFieldId ,
value ,
activityType : 'setCustomField' ,
boardId : doc . boardId ,
cardId : doc . _id ,
} ;
Activities . insert ( act ) ;
}
}
} ) ;
}
// Say goodbye to the former customField value
if ( modifier . $unset ) {
_ . each ( modifier . $unset , ( value , key ) => {
if ( key . startsWith ( 'customFields' ) ) {
const dotNotation = key . split ( '.' ) ;
// only individual changes are registered
if ( dotNotation . length > 1 ) {
2019-03-16 22:43:47 +01:00
const customFieldId = doc . customFields [ dotNotation [ 1 ] ] . _id ;
2019-03-08 11:28:21 +01:00
const act = {
userId ,
customFieldId ,
activityType : 'unsetCustomField' ,
boardId : doc . boardId ,
cardId : doc . _id ,
} ;
Activities . insert ( act ) ;
}
}
} ) ;
}
}
2017-07-19 10:27:23 +02:00
function cardCreation ( userId , doc ) {
Activities . insert ( {
userId ,
activityType : 'createCard' ,
boardId : doc . boardId ,
2018-09-14 18:03:57 +02:00
listName : Lists . findOne ( doc . listId ) . title ,
2017-07-19 10:27:23 +02:00
listId : doc . listId ,
cardId : doc . _id ,
2019-06-28 12:52:09 -05:00
cardTitle : doc . title ,
2018-12-30 22:08:34 +01:00
swimlaneName : Swimlanes . findOne ( doc . swimlaneId ) . title ,
2018-09-06 00:17:45 +02:00
swimlaneId : doc . swimlaneId ,
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
2017-07-19 10:27:23 +02:00
}
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
2017-07-19 10:27:23 +02:00
function cardRemover ( userId , doc ) {
2019-04-23 18:00:09 +02:00
ChecklistItems . remove ( {
2017-07-19 10:27:23 +02:00
cardId : doc . _id ,
} ) ;
Checklists . remove ( {
cardId : doc . _id ,
} ) ;
2019-03-05 22:48:29 +01:00
Cards . remove ( {
parentId : doc . _id ,
2018-06-18 23:25:56 +03:00
} ) ;
2017-07-19 10:27:23 +02:00
CardComments . remove ( {
cardId : doc . _id ,
} ) ;
Attachments . remove ( {
cardId : doc . _id ,
} ) ;
}
2019-07-09 16:36:50 -04:00
const findDueCards = days => {
const seekDue = ( $from , $to , activityType ) => {
Cards . find ( {
2019-09-25 11:26:46 -04:00
archived : false ,
2019-07-09 16:36:50 -04:00
dueAt : { $gte : $from , $lt : $to } ,
} ) . forEach ( card => {
const username = Users . findOne ( card . userId ) . username ;
const activity = {
userId : card . userId ,
username ,
activityType ,
boardId : card . boardId ,
cardId : card . _id ,
cardTitle : card . title ,
listId : card . listId ,
timeValue : card . dueAt ,
swimlaneId : card . swimlaneId ,
} ;
Activities . insert ( activity ) ;
} ) ;
} ;
const now = new Date ( ) ,
aday = 3600 * 24 * 1e3 ,
then = day => new Date ( now . setHours ( 0 , 0 , 0 , 0 ) + day * aday ) ;
2019-09-26 12:20:14 -04:00
if ( ! days ) return ;
if ( ! days . map ) days = [ days ] ;
days . map ( day => {
let args = [ ] ;
2019-09-26 12:24:40 -04:00
if ( day === 0 ) {
2019-09-26 12:20:14 -04:00
args = [ then ( 0 ) , then ( 1 ) , 'duenow' ] ;
} else if ( day > 0 ) {
args = [ then ( 1 ) , then ( day ) , 'almostdue' ] ;
} else {
args = [ then ( day ) , now , 'pastdue' ] ;
}
2019-09-26 12:24:40 -04:00
seekDue ( ... args ) ;
2019-09-26 12:20:14 -04:00
} ) ;
2019-07-09 16:36:50 -04:00
} ;
const addCronJob = _ . debounce (
Meteor . bindEnvironment ( function findDueCardsDebounced ( ) {
2019-09-26 12:20:14 -04:00
const envValue = process . env . NOTIFY _DUE _DAYS _BEFORE _AND _AFTER ;
if ( ! envValue ) {
2019-07-09 16:36:50 -04:00
return ;
}
2019-09-26 12:20:14 -04:00
const notifydays = envValue
. split ( ',' )
. map ( value => {
const iValue = parseInt ( value , 10 ) ;
if ( ! ( iValue > 0 && iValue < 15 ) ) {
// notifying due is disabled
return false ;
} else {
return iValue ;
}
} )
. filter ( Boolean ) ;
2019-07-10 13:45:37 -04:00
const notifyitvl = process . env . NOTIFY _DUE _AT _HOUR _OF _DAY ; //passed in the itvl has to be a number standing for the hour of current time
2019-07-09 16:36:50 -04:00
const defaultitvl = 8 ; // default every morning at 8am, if the passed env variable has parsing error use default
const itvl = parseInt ( notifyitvl , 10 ) || defaultitvl ;
const scheduler = ( job => ( ) => {
const now = new Date ( ) ;
const hour = 3600 * 1e3 ;
if ( now . getHours ( ) === itvl ) {
if ( typeof job === 'function' ) {
job ( ) ;
}
}
Meteor . setTimeout ( scheduler , hour ) ;
} ) ( ( ) => {
findDueCards ( notifydays ) ;
} ) ;
scheduler ( ) ;
} ) ,
500 ,
) ;
2017-07-19 10:27:23 +02:00
if ( Meteor . isServer ) {
2017-12-03 04:00:55 +02:00
// Cards are often fetched within a board, so we create an index to make these
// queries more efficient.
2017-07-19 10:27:23 +02:00
Meteor . startup ( ( ) => {
2019-06-26 17:47:27 -05:00
Cards . _collection . _ensureIndex ( { modifiedAt : - 1 } ) ;
Cards . _collection . _ensureIndex ( { boardId : 1 , createdAt : - 1 } ) ;
2018-08-28 21:01:55 +03:00
// https://github.com/wekan/wekan/issues/1863
// Swimlane added a new field in the cards collection of mongodb named parentId.
// When loading a board, mongodb is searching for every cards, the id of the parent (in the swinglanes collection).
// With a huge database, this result in a very slow app and high CPU on the mongodb side.
// To correct it, add Index to parentId:
2019-06-28 12:52:09 -05:00
Cards . _collection . _ensureIndex ( { parentId : 1 } ) ;
2019-07-10 17:46:07 -04:00
// let notifydays = parseInt(process.env.NOTIFY_DUE_DAYS_BEFORE_AND_AFTER) || 2; // default as 2 days b4 and after
// let notifyitvl = parseInt(process.env.NOTIFY_DUE_AT_HOUR_OF_DAY) || 3600 * 24 * 1e3; // default interval as one day
// Meteor.call("findDueCards",notifydays,notifyitvl);
2019-07-09 16:36:50 -04:00
Meteor . defer ( ( ) => {
addCronJob ( ) ;
} ) ;
2017-07-19 10:27:23 +02:00
} ) ;
Cards . after . insert ( ( userId , doc ) => {
cardCreation ( userId , doc ) ;
} ) ;
2017-12-03 04:00:55 +02:00
// New activity for card (un)archivage
2017-07-19 10:27:23 +02:00
Cards . after . update ( ( userId , doc , fieldNames ) => {
cardState ( userId , doc , fieldNames ) ;
} ) ;
2017-12-03 04:00:55 +02:00
//New activity for card moves
2018-09-14 18:03:57 +02:00
Cards . after . update ( function ( userId , doc , fieldNames ) {
2017-07-19 10:27:23 +02:00
const oldListId = this . previous . listId ;
2018-09-06 00:17:45 +02:00
const oldSwimlaneId = this . previous . swimlaneId ;
2019-03-16 22:43:47 +01:00
const oldBoardId = this . previous . boardId ;
cardMove ( userId , doc , fieldNames , oldListId , oldSwimlaneId , oldBoardId ) ;
2017-07-19 10:27:23 +02:00
} ) ;
2017-12-03 04:00:55 +02:00
// Add a new activity if we add or remove a member to the card
2017-07-19 10:27:23 +02:00
Cards . before . update ( ( userId , doc , fieldNames , modifier ) => {
cardMembers ( userId , doc , fieldNames , modifier ) ;
2019-03-16 22:43:47 +01:00
updateActivities ( doc , fieldNames , modifier ) ;
2017-07-19 10:27:23 +02:00
} ) ;
2019-10-31 02:21:50 +02:00
// Add a new activity if we add or remove a assignee to the card
Cards . before . update ( ( userId , doc , fieldNames , modifier ) => {
cardAssignees ( userId , doc , fieldNames , modifier ) ;
updateActivities ( doc , fieldNames , modifier ) ;
} ) ;
2018-08-16 16:54:29 +02:00
// Add a new activity if we add or remove a label to the card
Cards . before . update ( ( userId , doc , fieldNames , modifier ) => {
cardLabels ( userId , doc , fieldNames , modifier ) ;
} ) ;
2019-03-08 11:28:21 +01:00
// Add a new activity if we edit a custom field
Cards . before . update ( ( userId , doc , fieldNames , modifier ) => {
cardCustomFields ( userId , doc , fieldNames , modifier ) ;
} ) ;
2019-07-09 16:36:50 -04:00
// Add a new activity if modify time related field like dueAt startAt etc
Cards . before . update ( ( userId , doc , fieldNames , modifier ) => {
const dla = 'dateLastActivity' ;
const fields = fieldNames . filter ( name => name !== dla ) ;
const timingaction = [ 'receivedAt' , 'dueAt' , 'startAt' , 'endAt' ] ;
const action = fields [ 0 ] ;
if ( fields . length > 0 && _ . contains ( timingaction , action ) ) {
// add activities for user change these attributes
const value = modifier . $set [ action ] ;
const oldvalue = doc [ action ] || '' ;
const activityType = ` a- ${ action } ` ;
const card = Cards . findOne ( doc . _id ) ;
2019-10-10 22:57:40 -04:00
const list = card . list ( ) ;
2019-10-29 17:45:06 -04:00
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
2019-10-18 16:44:09 -04:00
const modifiedAt = new Date (
2019-10-30 12:26:39 -04:00
new Date ( value ) . getTime ( ) -
( action === 'endAt' ? 365 * 24 * 3600 * 1e3 : 0 ) ,
2019-10-18 16:44:09 -04:00
) ; // set it as 1 year before
2019-10-10 22:57:40 -04:00
const boardId = list . boardId ;
Lists . direct . update (
{
_id : list . _id ,
} ,
{
$set : {
modifiedAt ,
boardId ,
} ,
} ,
) ;
}
2019-07-09 16:36:50 -04:00
const username = Users . findOne ( userId ) . username ;
const activity = {
userId ,
username ,
activityType ,
boardId : doc . boardId ,
cardId : doc . _id ,
cardTitle : doc . title ,
timeKey : action ,
timeValue : value ,
timeOldValue : oldvalue ,
listId : card . listId ,
swimlaneId : card . swimlaneId ,
} ;
Activities . insert ( activity ) ;
}
} ) ;
2017-12-03 04:00:55 +02:00
// Remove all activities associated with a card if we remove the card
// Remove also card_comments / checklists / attachments
2019-04-23 18:00:09 +02:00
Cards . before . remove ( ( userId , doc ) => {
2017-07-19 10:27:23 +02:00
cardRemover ( userId , doc ) ;
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
} ) ;
}
2018-10-09 15:05:57 +00:00
//SWIMLANES REST API
if ( Meteor . isServer ) {
2018-10-26 07:27:24 +02:00
/ * *
* @ operation get _swimlane _cards
* @ summary get all cards attached to a swimlane
*
* @ param { string } boardId the board ID
* @ param { string } swimlaneId the swimlane ID
* @ return _type [ { _id : string ,
* title : string ,
* description : string ,
* listId : string } ]
* /
2019-06-28 12:52:09 -05:00
JsonRoutes . add (
'GET' ,
'/api/boards/:boardId/swimlanes/:swimlaneId/cards' ,
function ( req , res ) {
const paramBoardId = req . params . boardId ;
const paramSwimlaneId = req . params . swimlaneId ;
Authentication . checkBoardAccess ( req . userId , paramBoardId ) ;
JsonRoutes . sendResult ( res , {
code : 200 ,
data : Cards . find ( {
boardId : paramBoardId ,
swimlaneId : paramSwimlaneId ,
archived : false ,
} ) . map ( function ( doc ) {
return {
_id : doc . _id ,
title : doc . title ,
description : doc . description ,
listId : doc . listId ,
2020-06-01 15:44:51 +02:00
receivedAt : doc . receivedAt ,
2020-06-08 17:35:25 +03:00
startAt : doc . startAt ,
2020-06-01 14:23:43 +02:00
dueAt : doc . dueAt ,
endAt : doc . endAt ,
assignees : doc . assignees ,
2019-06-28 12:52:09 -05:00
} ;
} ) ,
} ) ;
} ,
) ;
2018-10-09 15:05:57 +00:00
}
2017-04-27 20:49:24 +03:00
//LISTS REST API
if ( Meteor . isServer ) {
2018-10-26 07:27:24 +02:00
/ * *
* @ operation get _all _cards
2019-01-20 00:53:59 +02:00
* @ summary Get all Cards attached to a List
2018-10-26 07:27:24 +02:00
*
* @ param { string } boardId the board ID
* @ param { string } listId the list ID
* @ return _type [ { _id : string ,
* title : string ,
* description : string } ]
* /
2019-06-28 12:52:09 -05:00
JsonRoutes . add ( 'GET' , '/api/boards/:boardId/lists/:listId/cards' , function (
req ,
res ,
) {
2017-04-27 20:49:24 +03:00
const paramBoardId = req . params . boardId ;
const paramListId = req . params . listId ;
2017-07-19 10:27:23 +02:00
Authentication . checkBoardAccess ( req . userId , paramBoardId ) ;
2017-04-27 20:49:24 +03:00
JsonRoutes . sendResult ( res , {
code : 200 ,
2018-09-14 18:03:57 +02:00
data : Cards . find ( {
boardId : paramBoardId ,
listId : paramListId ,
2018-09-16 01:50:36 +03:00
archived : false ,
2018-09-14 18:03:57 +02:00
} ) . map ( function ( doc ) {
2017-04-27 20:49:24 +03:00
return {
_id : doc . _id ,
title : doc . title ,
description : doc . description ,
2020-06-01 15:44:51 +02:00
receivedAt : doc . receivedAt ,
2020-06-08 17:35:25 +03:00
startAt : doc . startAt ,
2020-06-01 14:23:43 +02:00
dueAt : doc . dueAt ,
endAt : doc . endAt ,
assignees : doc . assignees ,
2017-04-27 20:49:24 +03:00
} ;
} ) ,
} ) ;
} ) ;
2018-10-26 07:27:24 +02:00
/ * *
* @ operation get _card
2019-01-20 00:53:59 +02:00
* @ summary Get a Card
2018-10-26 07:27:24 +02:00
*
* @ param { string } boardId the board ID
* @ param { string } listId the list ID of the card
* @ param { string } cardId the card ID
* @ return _type Cards
* /
2019-06-28 12:52:09 -05:00
JsonRoutes . add (
'GET' ,
'/api/boards/:boardId/lists/:listId/cards/:cardId' ,
function ( req , res ) {
const paramBoardId = req . params . boardId ;
const paramListId = req . params . listId ;
const paramCardId = req . params . cardId ;
Authentication . checkBoardAccess ( req . userId , paramBoardId ) ;
JsonRoutes . sendResult ( res , {
code : 200 ,
data : Cards . findOne ( {
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ) ,
} ) ;
} ,
) ;
2017-04-27 20:49:24 +03:00
2018-10-26 07:27:24 +02:00
/ * *
* @ operation new _card
2019-01-20 00:53:59 +02:00
* @ summary Create a new Card
2018-10-26 07:27:24 +02:00
*
* @ param { string } boardId the board ID of the new card
* @ param { string } listId the list ID of the new card
* @ param { string } authorID the user ID of the person owning the card
2019-05-12 10:01:32 -03:00
* @ param { string } parentId the parent ID of the new card
2018-10-26 07:27:24 +02:00
* @ param { string } title the title of the new card
* @ param { string } description the description of the new card
* @ param { string } swimlaneId the swimlane ID of the new card
* @ param { string } [ members ] the member IDs list of the new card
2019-11-07 22:46:55 +02:00
* @ param { string } [ assignees ] the array of maximum one ID of assignee of the new card
2018-10-26 07:27:24 +02:00
* @ return _type { _id : string }
* /
2019-06-28 12:52:09 -05:00
JsonRoutes . add ( 'POST' , '/api/boards/:boardId/lists/:listId/cards' , function (
req ,
res ,
) {
2019-12-17 12:15:06 +01:00
// Check user is logged in
Authentication . checkLoggedIn ( req . userId ) ;
2017-04-27 20:49:24 +03:00
const paramBoardId = req . params . boardId ;
2019-12-17 12:15:06 +01:00
// Check user has permission to add card to the board
const board = Boards . findOne ( {
2020-01-03 06:49:35 +02:00
_id : paramBoardId ,
2019-12-17 12:15:06 +01:00
} ) ;
const addPermission = allowIsBoardMemberCommentOnly ( req . userId , board ) ;
Authentication . checkAdminOrCondition ( req . userId , addPermission ) ;
2017-04-27 20:49:24 +03:00
const paramListId = req . params . listId ;
2019-05-12 10:01:32 -03:00
const paramParentId = req . params . parentId ;
2019-06-28 12:52:09 -05:00
const currentCards = Cards . find (
{
listId : paramListId ,
archived : false ,
} ,
{ sort : [ 'sort' ] } ,
) ;
2018-09-14 18:03:57 +02:00
const check = Users . findOne ( {
2018-09-16 01:50:36 +03:00
_id : req . body . authorId ,
2018-09-14 18:03:57 +02:00
} ) ;
2020-05-08 18:55:37 +02:00
const members = req . body . members ;
2019-10-31 02:21:50 +02:00
const assignees = req . body . assignees ;
2018-09-14 18:03:57 +02:00
if ( typeof check !== 'undefined' ) {
2017-07-19 10:27:23 +02:00
const id = Cards . direct . insert ( {
2017-07-07 11:37:35 +02:00
title : req . body . title ,
boardId : paramBoardId ,
listId : paramListId ,
2019-05-12 10:01:32 -03:00
parentId : paramParentId ,
2017-07-07 11:37:35 +02:00
description : req . body . description ,
userId : req . body . authorId ,
2018-02-19 14:55:56 +01:00
swimlaneId : req . body . swimlaneId ,
2019-01-25 12:44:27 +01:00
sort : currentCards . count ( ) ,
2018-05-05 00:30:34 +03:00
members ,
2019-10-31 02:21:50 +02:00
assignees ,
2017-07-07 11:37:35 +02:00
} ) ;
JsonRoutes . sendResult ( res , {
code : 200 ,
data : {
_id : id ,
} ,
} ) ;
2017-07-19 10:27:23 +02:00
2018-09-14 18:03:57 +02:00
const card = Cards . findOne ( {
2018-09-16 01:50:36 +03:00
_id : id ,
2018-09-14 18:03:57 +02:00
} ) ;
2017-07-19 10:27:23 +02:00
cardCreation ( req . body . authorId , card ) ;
} else {
2017-07-07 11:37:35 +02:00
JsonRoutes . sendResult ( res , {
code : 401 ,
} ) ;
2017-07-07 11:11:38 +02:00
}
2017-04-27 20:49:24 +03:00
} ) ;
2018-10-26 07:27:24 +02:00
/ *
* Note for the JSDoc :
* 'list' will be interpreted as the path parameter
* 'listID' will be interpreted as the body parameter
* /
/ * *
* @ operation edit _card
2019-01-20 00:53:59 +02:00
* @ summary Edit Fields in a Card
2018-10-26 07:27:24 +02:00
*
2018-07-24 18:18:40 +02:00
* @ description Edit a card
*
2019-01-22 23:35:12 +01:00
* The color has to be chosen between ` white ` , ` green ` , ` yellow ` , ` orange ` ,
* ` red ` , ` purple ` , ` blue ` , ` sky ` , ` lime ` , ` pink ` , ` black ` , ` silver ` ,
* ` peachpuff ` , ` crimson ` , ` plum ` , ` darkgreen ` , ` slateblue ` , ` magenta ` ,
* ` gold ` , ` navy ` , ` gray ` , ` saddlebrown ` , ` paleturquoise ` , ` mistyrose ` ,
* ` indigo ` :
2018-07-24 18:18:40 +02:00
*
* < img src = "/card-colors.png" width = "40%" alt = "Wekan card colors" / >
*
2019-01-22 23:35:12 +01:00
* Note : setting the color to white has the same effect than removing it .
*
2018-10-26 07:27:24 +02:00
* @ param { string } boardId the board ID of the card
* @ param { string } list the list ID of the card
* @ param { string } cardId the ID of the card
* @ param { string } [ title ] the new title of the card
* @ param { string } [ listId ] the new list ID of the card ( move operation )
* @ param { string } [ description ] the new description of the card
* @ param { string } [ authorId ] change the owner of the card
2019-05-12 10:01:32 -03:00
* @ param { string } [ parentId ] change the parent of the card
2018-10-26 07:27:24 +02:00
* @ param { string } [ labelIds ] the new list of label IDs attached to the card
* @ param { string } [ swimlaneId ] the new swimlane ID of the card
* @ param { string } [ members ] the new list of member IDs attached to the card
2019-11-07 22:46:55 +02:00
* @ param { string } [ assignees ] the array of maximum one ID of assignee attached to the card
2018-10-26 07:27:24 +02:00
* @ param { string } [ requestedBy ] the new requestedBy field of the card
* @ param { string } [ assignedBy ] the new assignedBy field of the card
* @ param { string } [ receivedAt ] the new receivedAt field of the card
* @ param { string } [ assignBy ] the new assignBy field of the card
* @ param { string } [ startAt ] the new startAt field of the card
* @ param { string } [ dueAt ] the new dueAt field of the card
* @ param { string } [ endAt ] the new endAt field of the card
* @ param { string } [ spentTime ] the new spentTime field of the card
* @ param { boolean } [ isOverTime ] the new isOverTime field of the card
* @ param { string } [ customFields ] the new customFields value of the card
2018-07-24 18:18:40 +02:00
* @ param { string } [ color ] the new color of the card
2020-06-11 19:52:44 +02:00
* @ param { Object } [ vote ] the vote object
* @ param { string } vote . question the vote question
* @ param { boolean } vote . public show who voted what
* @ param { boolean } vote . allowNonBoardMembers allow all logged in users to vote ?
2018-07-24 18:18:40 +02:00
* @ return _type { _id : string }
2018-10-26 07:27:24 +02:00
* /
2019-06-28 12:52:09 -05:00
JsonRoutes . add (
'PUT' ,
'/api/boards/:boardId/lists/:listId/cards/:cardId' ,
function ( req , res ) {
Authentication . checkUserId ( req . userId ) ;
const paramBoardId = req . params . boardId ;
const paramCardId = req . params . cardId ;
const paramListId = req . params . listId ;
if ( req . body . hasOwnProperty ( 'title' ) ) {
const newTitle = req . body . title ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{
$set : {
title : newTitle ,
} ,
} ,
) ;
}
if ( req . body . hasOwnProperty ( 'listId' ) ) {
const newParamListId = req . body . listId ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{
$set : {
listId : newParamListId ,
} ,
} ,
) ;
2017-07-19 10:27:23 +02:00
2019-06-28 12:52:09 -05:00
const card = Cards . findOne ( {
_id : paramCardId ,
} ) ;
cardMove (
req . body . authorId ,
card ,
{
fieldName : 'listId' ,
} ,
paramListId ,
) ;
}
if ( req . body . hasOwnProperty ( 'parentId' ) ) {
const newParentId = req . body . parentId ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{
$set : {
parentId : newParentId ,
} ,
} ,
) ;
}
if ( req . body . hasOwnProperty ( 'description' ) ) {
const newDescription = req . body . description ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{
$set : {
description : newDescription ,
} ,
} ,
) ;
}
if ( req . body . hasOwnProperty ( 'color' ) ) {
const newColor = req . body . color ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { color : newColor } } ,
) ;
}
2020-06-11 19:52:44 +02:00
if ( req . body . hasOwnProperty ( 'vote' ) ) {
const newVote = req . body . vote ;
newVote . positive = [ ] ;
newVote . negative = [ ] ;
if ( ! newVote . hasOwnProperty ( 'public' ) ) newVote . public = false ;
if ( ! newVote . hasOwnProperty ( 'allowNonBoardMembers' ) )
newVote . allowNonBoardMembers = false ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { vote : newVote } } ,
) ;
}
2019-06-28 12:52:09 -05:00
if ( req . body . hasOwnProperty ( 'labelIds' ) ) {
let newlabelIds = req . body . labelIds ;
if ( _ . isString ( newlabelIds ) ) {
if ( newlabelIds === '' ) {
newlabelIds = null ;
} else {
newlabelIds = [ newlabelIds ] ;
}
2018-06-27 16:44:58 +02:00
}
2019-06-28 12:52:09 -05:00
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{
$set : {
labelIds : newlabelIds ,
} ,
} ,
) ;
}
if ( req . body . hasOwnProperty ( 'requestedBy' ) ) {
const newrequestedBy = req . body . requestedBy ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { requestedBy : newrequestedBy } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'assignedBy' ) ) {
const newassignedBy = req . body . assignedBy ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { assignedBy : newassignedBy } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'receivedAt' ) ) {
const newreceivedAt = req . body . receivedAt ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { receivedAt : newreceivedAt } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'startAt' ) ) {
const newstartAt = req . body . startAt ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { startAt : newstartAt } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'dueAt' ) ) {
const newdueAt = req . body . dueAt ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { dueAt : newdueAt } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'endAt' ) ) {
const newendAt = req . body . endAt ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { endAt : newendAt } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'spentTime' ) ) {
const newspentTime = req . body . spentTime ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { spentTime : newspentTime } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'isOverTime' ) ) {
const newisOverTime = req . body . isOverTime ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { isOverTime : newisOverTime } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'customFields' ) ) {
const newcustomFields = req . body . customFields ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { customFields : newcustomFields } } ,
) ;
}
if ( req . body . hasOwnProperty ( 'members' ) ) {
let newmembers = req . body . members ;
if ( _ . isString ( newmembers ) ) {
if ( newmembers === '' ) {
newmembers = null ;
} else {
newmembers = [ newmembers ] ;
}
2018-06-27 16:44:58 +02:00
}
2019-06-28 12:52:09 -05:00
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { members : newmembers } } ,
) ;
2018-06-26 20:59:04 +02:00
}
2019-10-31 02:21:50 +02:00
if ( req . body . hasOwnProperty ( 'assignees' ) ) {
let newassignees = req . body . assignees ;
if ( _ . isString ( newassignees ) ) {
if ( newassignees === '' ) {
newassignees = null ;
} else {
newassignees = [ newassignees ] ;
}
}
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { assignees : newassignees } } ,
) ;
}
2019-06-28 12:52:09 -05:00
if ( req . body . hasOwnProperty ( 'swimlaneId' ) ) {
const newParamSwimlaneId = req . body . swimlaneId ;
Cards . direct . update (
{
_id : paramCardId ,
listId : paramListId ,
boardId : paramBoardId ,
archived : false ,
} ,
{ $set : { swimlaneId : newParamSwimlaneId } } ,
) ;
}
JsonRoutes . sendResult ( res , {
code : 200 ,
data : {
_id : paramCardId ,
2018-09-16 01:50:36 +03:00
} ,
2018-09-14 18:03:57 +02:00
} ) ;
2019-06-28 12:52:09 -05:00
} ,
) ;
2017-06-29 12:24:33 +02:00
2018-10-26 07:27:24 +02:00
/ * *
* @ operation delete _card
* @ summary Delete a card from a board
*
* @ description This operation * * deletes * * a card , and therefore the card
* is not put in the recycle bin .
*
* @ param { string } boardId the board ID of the card
* @ param { string } list the list ID of the card
* @ param { string } cardId the ID of the card
* @ return _type { _id : string }
* /
2019-06-28 12:52:09 -05:00
JsonRoutes . add (
'DELETE' ,
'/api/boards/:boardId/lists/:listId/cards/:cardId' ,
function ( req , res ) {
Authentication . checkUserId ( req . userId ) ;
const paramBoardId = req . params . boardId ;
const paramListId = req . params . listId ;
const paramCardId = req . params . cardId ;
2019-11-04 06:08:40 +01:00
const card = Cards . findOne ( {
_id : paramCardId ,
} ) ;
2019-06-28 12:52:09 -05:00
Cards . direct . remove ( {
2017-04-27 20:49:24 +03:00
_id : paramCardId ,
2019-06-28 12:52:09 -05:00
listId : paramListId ,
boardId : paramBoardId ,
} ) ;
cardRemover ( req . body . authorId , card ) ;
JsonRoutes . sendResult ( res , {
code : 200 ,
data : {
_id : paramCardId ,
} ,
} ) ;
} ,
) ;
2020-05-27 11:13:09 +02:00
/ * *
* @ operation get _cards _by _custom _field
* @ summary Get all Cards that matchs a value of a specific custom field
*
* @ param { string } boardId the board ID
* @ param { string } customFieldId the list ID
* @ param { string } customFieldValue the value to look for
* @ return _type [ { _id : string ,
* title : string ,
* description : string ,
2020-06-17 05:40:17 +02:00
* listId : string ,
2020-05-27 11:13:09 +02:00
* swinlaneId : string } ]
* /
JsonRoutes . add (
'GET' ,
'/api/boards/:boardId/cardsByCustomField/:customFieldId/:customFieldValue' ,
function ( req , res ) {
const paramBoardId = req . params . boardId ;
const paramCustomFieldId = req . params . customFieldId ;
const paramCustomFieldValue = req . params . customFieldValue ;
Authentication . checkBoardAccess ( req . userId , paramBoardId ) ;
JsonRoutes . sendResult ( res , {
code : 200 ,
data : Cards . find ( {
boardId : paramBoardId ,
customFields : {
$elemMatch : {
_id : paramCustomFieldId ,
value : paramCustomFieldValue ,
} ,
} ,
archived : false ,
} ) . map ( function ( doc ) {
return {
_id : doc . _id ,
title : doc . title ,
description : doc . description ,
listId : doc . listId ,
swinlaneId : doc . swinlaneId ,
} ;
} ) ,
} ) ;
} ,
) ;
2017-04-27 20:49:24 +03:00
}
2019-06-26 17:47:27 -05:00
export default Cards ;