2023-01-14 13:29:57 +01:00
|
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
|
|
|
|
2021-08-13 20:47:55 +02:00
|
|
|
const commentReactionSchema = new SimpleSchema({
|
2023-04-18 01:30:54 +03:00
|
|
|
reactionCodepoint: {
|
|
|
|
|
type: String,
|
|
|
|
|
optional: false,
|
|
|
|
|
max: 9, // max length of reaction code
|
|
|
|
|
custom() {
|
|
|
|
|
if (!this.value.match(/^&#\d{4,6};$/)) { // regex for only valid reactions
|
|
|
|
|
return "incorrectReactionCode";
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-08-13 20:47:55 +02:00
|
|
|
userIds: { type: [String], defaultValue: [] }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CardCommentReactions = new Mongo.Collection('card_comment_reactions');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* All reactions of a card comment
|
|
|
|
|
*/
|
|
|
|
|
CardCommentReactions.attachSchema(
|
|
|
|
|
new SimpleSchema({
|
|
|
|
|
boardId: {
|
|
|
|
|
/**
|
|
|
|
|
* the board ID
|
|
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: false
|
|
|
|
|
},
|
|
|
|
|
cardId: {
|
|
|
|
|
/**
|
|
|
|
|
* the card ID
|
|
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: false
|
|
|
|
|
},
|
|
|
|
|
cardCommentId: {
|
|
|
|
|
/**
|
|
|
|
|
* the card comment ID
|
|
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: false
|
|
|
|
|
},
|
|
|
|
|
reactions: {
|
|
|
|
|
type: [commentReactionSchema],
|
|
|
|
|
defaultValue: []
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CardCommentReactions.allow({
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async insert(userId, doc) {
|
|
|
|
|
return allowIsBoardMember(userId, await ReactiveCache.getBoard(doc.boardId));
|
2021-08-13 20:47:55 +02:00
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async update(userId, doc) {
|
|
|
|
|
return allowIsBoardMember(userId, await ReactiveCache.getBoard(doc.boardId));
|
2021-08-13 20:47:55 +02:00
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async remove(userId, doc) {
|
|
|
|
|
return allowIsBoardMember(userId, await ReactiveCache.getBoard(doc.boardId));
|
2021-08-13 20:47:55 +02:00
|
|
|
},
|
|
|
|
|
fetch: ['boardId'],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Meteor.isServer) {
|
2026-01-24 01:55:29 +02:00
|
|
|
Meteor.startup(async () => {
|
|
|
|
|
await CardCommentReactions._collection.createIndexAsync({ cardCommentId: 1 }, { unique: true });
|
2021-08-13 20:47:55 +02:00
|
|
|
});
|
|
|
|
|
}
|