diff --git a/src/core/server/models/action/comment.ts b/src/core/server/models/action/comment.ts index 0f90cd8f2..baa22e84f 100644 --- a/src/core/server/models/action/comment.ts +++ b/src/core/server/models/action/comment.ts @@ -140,7 +140,7 @@ export async function createCommentActionIndexes(mongo: Db) { // UNIQUE { id } await createIndex({ tenantID: 1, id: 1 }, { unique: true }); - // { actionType, commentID } + // { actionType, commentID, userID } await createIndex( { tenantID: 1, actionType: 1, commentID: 1, userID: 1 }, { background: true } @@ -232,7 +232,7 @@ export async function createAction( input: CreateActionInput, now = new Date() ): Promise { - const { metadata, additionalDetails, ...filter } = input; + const { metadata, additionalDetails, ...rest } = input; // Create a new ID for the action. const id = uuid.v4(); @@ -245,6 +245,12 @@ export async function createAction( createdAt: now, }; + // Extract the filter parameters. + const filter: FilterQuery = { + tenantID, + ...rest, + }; + // Merge the defaults with the input. const action: Readonly = { ...defaults,