-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
users.js
2664 lines (2526 loc) · 68.7 KB
/
users.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { ReactiveCache, ReactiveMiniMongoIndex } from '/imports/reactiveCache';
import { SyncedCron } from 'meteor/percolate:synced-cron';
import { TAPi18n } from '/imports/i18n';
import ImpersonatedUsers from './impersonatedUsers';
import { Index, MongoDBEngine } from 'meteor/easy:search';
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
// in the package definition.
const isSandstorm =
Meteor.settings && Meteor.settings.public && Meteor.settings.public.sandstorm;
Users = Meteor.users;
const allowedSortValues = [
'-modifiedAt',
'modifiedAt',
'-title',
'title',
'-sort',
'sort',
];
const defaultSortBy = allowedSortValues[0];
/**
* A User in wekan
*/
Users.attachSchema(
new SimpleSchema({
username: {
/**
* the username of the user
*/
type: String,
optional: true,
// eslint-disable-next-line consistent-return
autoValue() {
if (this.isInsert && !this.isSet) {
const name = this.field('profile.fullname');
if (name.isSet) {
return name.value.toLowerCase().replace(/\s/g, '');
}
}
},
},
orgs: {
/**
* the list of organizations that a user belongs to
*/
type: [Object],
optional: true,
},
'orgs.$.orgId': {
/**
* The uniq ID of the organization
*/
type: String,
},
'orgs.$.orgDisplayName': {
/**
* The display name of the organization
*/
type: String,
},
teams: {
/**
* the list of teams that a user belongs to
*/
type: [Object],
optional: true,
},
'teams.$.teamId': {
/**
* The uniq ID of the team
*/
type: String,
},
'teams.$.teamDisplayName': {
/**
* The display name of the team
*/
type: String,
},
emails: {
/**
* the list of emails attached to a user
*/
type: [Object],
optional: true,
},
'emails.$.address': {
/**
* The email address
*/
type: String,
regEx: SimpleSchema.RegEx.Email,
},
'emails.$.verified': {
/**
* Has the email been verified
*/
type: Boolean,
},
createdAt: {
/**
* creation date of the user
*/
type: Date,
// eslint-disable-next-line consistent-return
autoValue() {
if (this.isInsert) {
return new Date();
} else if (this.isUpsert) {
return {
$setOnInsert: new Date(),
};
} 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();
}
},
},
profile: {
/**
* profile settings
*/
type: Object,
optional: true,
// eslint-disable-next-line consistent-return
autoValue() {
if (this.isInsert && !this.isSet) {
return {
boardView: 'board-view-swimlanes',
};
}
},
},
'profile.avatarUrl': {
/**
* URL of the avatar of the user
*/
type: String,
optional: true,
},
'profile.emailBuffer': {
/**
* list of email buffers of the user
*/
type: [String],
optional: true,
},
'profile.fullname': {
/**
* full name of the user
*/
type: String,
optional: true,
},
'profile.showDesktopDragHandles': {
/**
* does the user want to show desktop drag handles?
*/
type: Boolean,
optional: true,
},
'profile.hideCheckedItems': {
/**
* does the user want to hide checked checklist items?
*/
type: Boolean,
optional: true,
},
'profile.cardMaximized': {
/**
* has user clicked maximize card?
*/
type: Boolean,
optional: true,
},
'profile.customFieldsGrid': {
/**
* has user at card Custom Fields have Grid (false) or one per row (true) layout?
*/
type: Boolean,
optional: true,
},
'profile.hiddenSystemMessages': {
/**
* does the user want to hide system messages?
*/
type: Boolean,
optional: true,
},
'profile.hiddenMinicardLabelText': {
/**
* does the user want to hide minicard label texts?
*/
type: Boolean,
optional: true,
},
'profile.initials': {
/**
* initials of the user
*/
type: String,
optional: true,
},
'profile.invitedBoards': {
/**
* board IDs the user has been invited to
*/
type: [String],
optional: true,
},
'profile.language': {
/**
* language of the user
*/
type: String,
optional: true,
},
'profile.moveAndCopyDialog': {
/**
* move and copy card dialog
*/
type: Object,
optional: true,
blackbox: true,
},
'profile.moveAndCopyDialog.$.boardId': {
/**
* last selected board id
*/
type: String,
},
'profile.moveAndCopyDialog.$.swimlaneId': {
/**
* last selected swimlane id
*/
type: String,
},
'profile.moveAndCopyDialog.$.listId': {
/**
* last selected list id
*/
type: String,
},
'profile.moveChecklistDialog': {
/**
* move checklist dialog
*/
type: Object,
optional: true,
blackbox: true,
},
'profile.moveChecklistDialog.$.boardId': {
/**
* last selected board id
*/
type: String,
},
'profile.moveChecklistDialog.$.swimlaneId': {
/**
* last selected swimlane id
*/
type: String,
},
'profile.moveChecklistDialog.$.listId': {
/**
* last selected list id
*/
type: String,
},
'profile.moveChecklistDialog.$.cardId': {
/**
* last selected card id
*/
type: String,
},
'profile.copyChecklistDialog': {
/**
* copy checklist dialog
*/
type: Object,
optional: true,
blackbox: true,
},
'profile.copyChecklistDialog.$.boardId': {
/**
* last selected board id
*/
type: String,
},
'profile.copyChecklistDialog.$.swimlaneId': {
/**
* last selected swimlane id
*/
type: String,
},
'profile.copyChecklistDialog.$.listId': {
/**
* last selected list id
*/
type: String,
},
'profile.copyChecklistDialog.$.cardId': {
/**
* last selected card id
*/
type: String,
},
'profile.notifications': {
/**
* enabled notifications for the user
*/
type: [Object],
optional: true,
},
'profile.notifications.$.activity': {
/**
* The id of the activity this notification references
*/
type: String,
},
'profile.notifications.$.read': {
/**
* the date on which this notification was read
*/
type: Date,
optional: true,
},
'profile.rescueCardDescription': {
/**
* show dialog for saving card description on unintentional card closing
*/
type: Boolean,
optional: true,
},
'profile.showCardsCountAt': {
/**
* showCardCountAt field of the user
*/
type: Number,
optional: true,
},
'profile.startDayOfWeek': {
/**
* startDayOfWeek field of the user
*/
type: Number,
optional: true,
},
'profile.starredBoards': {
/**
* list of starred board IDs
*/
type: [String],
optional: true,
},
'profile.icode': {
/**
* icode
*/
type: String,
optional: true,
},
'profile.boardView': {
/**
* boardView field of the user
*/
type: String,
optional: true,
allowedValues: [
'board-view-swimlanes',
'board-view-lists',
'board-view-cal',
],
},
'profile.listSortBy': {
/**
* default sort list for user
*/
type: String,
optional: true,
defaultValue: defaultSortBy,
allowedValues: allowedSortValues,
},
'profile.templatesBoardId': {
/**
* Reference to the templates board
*/
type: String,
defaultValue: '',
},
'profile.cardTemplatesSwimlaneId': {
/**
* Reference to the card templates swimlane Id
*/
type: String,
defaultValue: '',
},
'profile.listTemplatesSwimlaneId': {
/**
* Reference to the list templates swimlane Id
*/
type: String,
defaultValue: '',
},
'profile.boardTemplatesSwimlaneId': {
/**
* Reference to the board templates swimlane Id
*/
type: String,
defaultValue: '',
},
'profile.listWidths': {
/**
* User-specified width of each list (or nothing if default).
* profile[boardId][listId] = width;
*/
type: Object,
defaultValue: {},
blackbox: true,
},
'profile.swimlaneHeights': {
/**
* User-specified heights of each swimlane (or nothing if default).
* profile[boardId][swimlaneId] = height;
*/
type: Object,
defaultValue: {},
blackbox: true,
},
services: {
/**
* services field of the user
*/
type: Object,
optional: true,
blackbox: true,
},
heartbeat: {
/**
* last time the user has been seen
*/
type: Date,
optional: true,
},
isAdmin: {
/**
* is the user an admin of the board?
*/
type: Boolean,
optional: true,
},
createdThroughApi: {
/**
* was the user created through the API?
*/
type: Boolean,
optional: true,
},
loginDisabled: {
/**
* loginDisabled field of the user
*/
type: Boolean,
optional: true,
},
authenticationMethod: {
/**
* authentication method of the user
*/
type: String,
optional: false,
defaultValue: 'password',
},
sessionData: {
/**
* profile settings
*/
type: Object,
optional: true,
// eslint-disable-next-line consistent-return
autoValue() {
if (this.isInsert && !this.isSet) {
return {};
}
},
},
'sessionData.totalHits': {
/**
* Total hits from last searchquery['members.userId'] = Meteor.userId();
* last hit that was returned
*/
type: Number,
optional: true,
},
importUsernames: {
/**
* username for imported
*/
type: [String],
optional: true,
},
lastConnectionDate: {
type: Date,
optional: true,
},
}),
);
Users.allow({
update(userId, doc) {
const user = ReactiveCache.getUser(userId) || ReactiveCache.getCurrentUser();
if (user?.isAdmin)
return true;
if (!user) {
return false;
}
return doc._id === userId;
},
remove(userId, doc) {
const adminsNumber = ReactiveCache.getUsers({
isAdmin: true,
}).length;
const isAdmin = ReactiveCache.getUser(
{
_id: userId,
},
{
fields: {
isAdmin: 1,
},
},
);
// Prevents remove of the only one administrator
if (adminsNumber === 1 && isAdmin && userId === doc._id) {
return false;
}
// If it's the user or an admin
return userId === doc._id || isAdmin;
},
fetch: [],
});
// Non-Admin users can not change to Admin
Users.deny({
update(userId, board, fieldNames) {
return _.contains(fieldNames, 'isAdmin') && !ReactiveCache.getCurrentUser().isAdmin;
},
fetch: [],
});
// Search a user in the complete server database by its name, username or emails adress. This
// is used for instance to add a new user to a board.
UserSearchIndex = new Index({
collection: Users,
fields: ['username', 'profile.fullname', 'profile.avatarUrl'],
allowedFields: ['username', 'profile.fullname', 'profile.avatarUrl'],
engine: new MongoDBEngine({
fields: function (searchObject, options) {
return {
username: 1,
'profile.fullname': 1,
'profile.avatarUrl': 1,
};
},
}),
});
Users.safeFields = {
_id: 1,
username: 1,
'profile.fullname': 1,
'profile.avatarUrl': 1,
'profile.initials': 1,
orgs: 1,
teams: 1,
authenticationMethod: 1,
lastConnectionDate: 1,
};
if (Meteor.isClient) {
Users.helpers({
isBoardMember() {
const board = Utils.getCurrentBoard();
return board && board.hasMember(this._id);
},
isNotNoComments() {
const board = Utils.getCurrentBoard();
return (
board && board.hasMember(this._id) && !board.hasNoComments(this._id)
);
},
isNoComments() {
const board = Utils.getCurrentBoard();
return board && board.hasNoComments(this._id);
},
isNotCommentOnly() {
const board = Utils.getCurrentBoard();
return (
board && board.hasMember(this._id) && !board.hasCommentOnly(this._id)
);
},
isCommentOnly() {
const board = Utils.getCurrentBoard();
return board && board.hasCommentOnly(this._id);
},
isNotWorker() {
const board = Utils.getCurrentBoard();
return board && board.hasMember(this._id) && !board.hasWorker(this._id);
},
isWorker() {
const board = Utils.getCurrentBoard();
return board && board.hasWorker(this._id);
},
isBoardAdmin(boardId) {
let board;
if (boardId) {
board = ReactiveCache.getBoard(boardId);
} else {
board = Utils.getCurrentBoard();
}
return board && board.hasAdmin(this._id);
},
});
}
Users.parseImportUsernames = (usernamesString) => {
return usernamesString.trim().split(new RegExp('\\s*[,;]\\s*'));
};
Users.helpers({
importUsernamesString() {
if (this.importUsernames) {
return this.importUsernames.join(', ');
}
return '';
},
teamIds() {
if (this.teams) {
// TODO: Should the Team collection be queried to determine if the team isActive?
return this.teams.map((team) => {
return team.teamId;
});
}
return [];
},
orgIds() {
if (this.orgs) {
// TODO: Should the Org collection be queried to determine if the organization isActive?
return this.orgs.map((org) => {
return org.orgId;
});
}
return [];
},
orgsUserBelongs() {
if (this.orgs) {
return this.orgs
.map(function (org) {
return org.orgDisplayName;
})
.sort()
.join(',');
}
return '';
},
orgIdsUserBelongs() {
let ret = '';
if (this.orgs) {
ret = this.orgs.map(org => org.orgId).join(',');
}
return ret;
},
teamsUserBelongs() {
if (this.teams) {
return this.teams
.map(function (team) {
return team.teamDisplayName;
})
.sort()
.join(',');
}
return '';
},
teamIdsUserBelongs() {
let ret = '';
if (this.teams) {
ret = this.teams.map(team => team.teamId).join(',');
}
return ret;
},
boards() {
return Boards.userBoards(this._id, null, {}, { sort: { sort: 1 } });
},
starredBoards() {
const { starredBoards = [] } = this.profile || {};
return Boards.userBoards(
this._id,
false,
{ _id: { $in: starredBoards } },
{ sort: { sort: 1 } },
);
},
hasStarred(boardId) {
const { starredBoards = [] } = this.profile || {};
return _.contains(starredBoards, boardId);
},
invitedBoards() {
const { invitedBoards = [] } = this.profile || {};
return Boards.userBoards(
this._id,
false,
{ _id: { $in: invitedBoards } },
{ sort: { sort: 1 } },
);
},
isInvitedTo(boardId) {
const { invitedBoards = [] } = this.profile || {};
return _.contains(invitedBoards, boardId);
},
_getListSortBy() {
const profile = this.profile || {};
const sortBy = profile.listSortBy || defaultSortBy;
const keyPattern = /^(-{0,1})(.*$)/;
const ret = [];
if (keyPattern.exec(sortBy)) {
ret[0] = RegExp.$2;
ret[1] = RegExp.$1 ? -1 : 1;
}
return ret;
},
hasSortBy() {
// if use doesn't have dragHandle, then we can let user to choose sort list by different order
return !this.hasShowDesktopDragHandles();
},
getListSortBy() {
return this._getListSortBy()[0];
},
getListSortTypes() {
return allowedSortValues;
},
getListSortByDirection() {
return this._getListSortBy()[1];
},
getListWidths() {
const { listWidths = {} } = this.profile || {};
return listWidths;
},
getListWidth(boardId, listId) {
const listWidths = this.getListWidths();
if (listWidths[boardId] && listWidths[boardId][listId]) {
return listWidths[boardId][listId];
} else {
return 270; //TODO(mark-i-m): default?
}
},
getSwimlaneHeights() {
const { swimlaneHeights = {} } = this.profile || {};
return swimlaneHeights;
},
getSwimlaneHeight(boardId, listId) {
const swimlaneHeights = this.getSwimlaneHeights();
if (swimlaneHeights[boardId] && swimlaneHeights[boardId][listId]) {
return swimlaneHeights[boardId][listId];
} else {
return -1;
}
},
/** returns all confirmed move and copy dialog field values
* <li> the board, swimlane and list id is stored for each board
*/
getMoveAndCopyDialogOptions() {
let _ret = {};
if (this.profile && this.profile.moveAndCopyDialog) {
_ret = this.profile.moveAndCopyDialog;
}
return _ret;
},
/** returns all confirmed move checklist dialog field values
* <li> the board, swimlane, list and card id is stored for each board
*/
getMoveChecklistDialogOptions() {
let _ret = {};
if (this.profile && this.profile.moveChecklistDialog) {
_ret = this.profile.moveChecklistDialog;
}
return _ret;
},
/** returns all confirmed copy checklist dialog field values
* <li> the board, swimlane, list and card id is stored for each board
*/
getCopyChecklistDialogOptions() {
let _ret = {};
if (this.profile && this.profile.copyChecklistDialog) {
_ret = this.profile.copyChecklistDialog;
}
return _ret;
},
hasTag(tag) {
const { tags = [] } = this.profile || {};
return _.contains(tags, tag);
},
hasNotification(activityId) {
const { notifications = [] } = this.profile || {};
return _.contains(notifications, activityId);
},
notifications() {
const { notifications = [] } = this.profile || {};
for (const index in notifications) {
if (!notifications.hasOwnProperty(index)) continue;
const notification = notifications[index];
// this preserves their db sort order for editing
notification.dbIndex = index;
if (!notification.activityObj && typeof(notification.activity) === 'string') {
notification.activityObj = ReactiveMiniMongoIndex.getActivityWithId(notification.activity);
}
}
// newest first. don't use reverse() because it changes the array inplace, so sometimes the array is reversed twice and oldest items at top again
const ret = notifications.toReversed();
return ret;
},
hasShowDesktopDragHandles() {
const profile = this.profile || {};
return profile.showDesktopDragHandles || false;
},
hasHideCheckedItems() {
const profile = this.profile || {};
return profile.hideCheckedItems || false;
},
hasHiddenSystemMessages() {
const profile = this.profile || {};
return profile.hiddenSystemMessages || false;
},
hasCustomFieldsGrid() {
const profile = this.profile || {};
return profile.customFieldsGrid || false;
},
hasCardMaximized() {
const profile = this.profile || {};
return profile.cardMaximized || false;
},
hasHiddenMinicardLabelText() {
const profile = this.profile || {};
return profile.hiddenMinicardLabelText || false;
},
hasRescuedCardDescription() {
const profile = this.profile || {};
return profile.rescueCardDescription || false;
},
getEmailBuffer() {
const { emailBuffer = [] } = this.profile || {};
return emailBuffer;
},
getInitials() {
const profile = this.profile || {};
if (profile.initials) return profile.initials;
else if (profile.fullname) {
return profile.fullname
.split(/\s+/)
.reduce((memo, word) => {
return memo + word[0];
}, '')
.toUpperCase();
} else {
return this.username[0].toUpperCase();
}
},
getLimitToShowCardsCount() {
const profile = this.profile || {};
return profile.showCardsCountAt;
},
getName() {
const profile = this.profile || {};
return profile.fullname || this.username;
},
getLanguage() {
const profile = this.profile || {};
return profile.language || 'en';
},
getStartDayOfWeek() {
const profile = this.profile || {};
if (typeof profile.startDayOfWeek === 'undefined') {
// default is 'Monday' (1)
return 1;
}
return profile.startDayOfWeek;
},
getTemplatesBoardId() {
return (this.profile || {}).templatesBoardId;
},
getTemplatesBoardSlug() {
//return (ReactiveCache.getBoard((this.profile || {}).templatesBoardId) || {}).slug;
return 'templates';
},
remove() {
User.remove({
_id: this._id,
});
},
});
Users.mutations({
/** set the confirmed board id/swimlane id/list id of a board
* @param boardId the current board id
* @param options an object with the confirmed field values
*/
setMoveAndCopyDialogOption(boardId, options) {
let currentOptions = this.getMoveAndCopyDialogOptions();
currentOptions[boardId] = options;
return {
$set: {
'profile.moveAndCopyDialog': currentOptions,
},
};
},
/** set the confirmed board id/swimlane id/list id/card id of a board (move checklist)
* @param boardId the current board id
* @param options an object with the confirmed field values
*/
setMoveChecklistDialogOption(boardId, options) {
let currentOptions = this.getMoveChecklistDialogOptions();
currentOptions[boardId] = options;
return {
$set: {
'profile.moveChecklistDialog': currentOptions,
},
};
},
/** set the confirmed board id/swimlane id/list id/card id of a board (copy checklist)
* @param boardId the current board id
* @param options an object with the confirmed field values
*/
setCopyChecklistDialogOption(boardId, options) {
let currentOptions = this.getCopyChecklistDialogOptions();
currentOptions[boardId] = options;
return {
$set: {
'profile.copyChecklistDialog': currentOptions,
},
};
},
toggleBoardStar(boardId) {
const queryKind = this.hasStarred(boardId) ? '$pull' : '$addToSet';
return {
[queryKind]: {
'profile.starredBoards': boardId,
},
};
},