Skip to content

Commit

Permalink
Merge pull request #8736 from ever-co/fix/create-mention-from-comment…
Browse files Browse the repository at this point in the history
…-missing-organizationId

Fix/create mention from comment missing organization
  • Loading branch information
rahul-rocket authored Jan 17, 2025
2 parents fbbe7bb + 8c0a804 commit c637575
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/lib/comment/comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export class CommentService extends TenantAwareCrudService<Comment> {
mentionedUserId,
mentionById: user.id,
parentEntityId: comment.entityId,
parentEntityType: comment.entity
parentEntityType: comment.entity,
organizationId: comment.organizationId,
tenantId
})
)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { CommandHandler, ICommandHandler, EventBus as CqrsEventBus } from '@nestjs/cqrs';
import { HttpException, HttpStatus, Logger } from '@nestjs/common';
import { BaseEntityEnum, ActorTypeEnum, ITask, ActionTypeEnum, SubscriptionTypeEnum, ID, IEmployee } from '@gauzy/contracts';
import {
BaseEntityEnum,
ActorTypeEnum,
ITask,
ActionTypeEnum,
SubscriptionTypeEnum,
ID,
IEmployee
} from '@gauzy/contracts';
import { EventBus } from '../../../event-bus';
import { TaskEvent } from '../../../event-bus/events';
import { BaseEntityEventTypeEnum } from '../../../event-bus/base-entity-event';
Expand Down Expand Up @@ -88,7 +96,9 @@ export class TaskCreateHandler implements ICommandHandler<TaskCreateCommand> {
entity: BaseEntityEnum.Task,
entityId: task.id,
mentionedUserId,
mentionById: task.creatorId
mentionById: task.creatorId,
organizationId,
tenantId
})
)
);
Expand Down Expand Up @@ -121,16 +131,18 @@ export class TaskCreateHandler implements ICommandHandler<TaskCreateCommand> {

// Publish subscription events for each employee
await Promise.all(
employees.map(({ userId }: IEmployee) => this._cqrsEventBus.publish(
new CreateSubscriptionEvent({
entity: BaseEntityEnum.Task,
entityId: task.id,
userId,
type: SubscriptionTypeEnum.ASSIGNMENT,
organizationId,
tenantId
})
))
employees.map(({ userId }: IEmployee) =>
this._cqrsEventBus.publish(
new CreateSubscriptionEvent({
entity: BaseEntityEnum.Task,
entityId: task.id,
userId,
type: SubscriptionTypeEnum.ASSIGNMENT,
organizationId,
tenantId
})
)
)
);
} catch (error) {
this.logger.error('Error while subscribing members to task', error);
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/lib/tasks/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,6 @@ export class TaskService extends TenantAwareCrudService<Task> {
qb.andWhere(p(`"${query.alias}"."organizationSprintId" = :organizationSprintId`), {
organizationSprintId
});
} else {
qb.andWhere(p(`"${query.alias}"."organizationSprintId" IS NULL`));
}
qb.andWhere(p(`"${query.alias}"."isScreeningTask" = :isScreeningTask`), { isScreeningTask });
})
Expand Down

0 comments on commit c637575

Please sign in to comment.