Skip to content

Commit 368ecb7

Browse files
committed
#3945 changed fix to services only
1 parent 296b450 commit 368ecb7

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/backend/src/services/tasks.services.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ export default class TasksService {
122122

123123
const newTask = taskTransformer(createdTask);
124124

125-
await sendSlackTaskAssignedNotificationToUsers(newTask, assignees, organization.organizationId, createdBy.userId);
125+
const nonSelfAssigneeIds = assignees.filter((id) => id !== createdBy.userId);
126+
await sendSlackTaskAssignedNotificationToUsers(newTask, nonSelfAssigneeIds, organization.organizationId);
126127

127128
return newTask;
128129
}
@@ -254,7 +255,8 @@ export default class TasksService {
254255
})
255256
);
256257

257-
await sendSlackTaskAssignedNotificationToUsers(updatedTask, newAssigneeIds, organization.organizationId, user.userId);
258+
const nonSelfAssigneeIds = newAssigneeIds.filter((id) => id !== user.userId);
259+
await sendSlackTaskAssignedNotificationToUsers(updatedTask, nonSelfAssigneeIds, organization.organizationId);
258260

259261
return updatedTask;
260262
}

src/backend/src/utils/tasks.utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ export const convertTaskStatus = (status: Task_Status): TaskStatus =>
2222
* @param task the task the users are assigned to
2323
* @param assigneeIds the user ids of the users assigned to the task
2424
* @param orgainzationId the organization id of the current user
25-
* @param assignerId the user id of the user who assigned the task
2625
*/
2726
export const sendSlackTaskAssignedNotificationToUsers = async (
2827
task: Task,
2928
assigneeIds: string[],
30-
orgainzationId: string,
31-
assignerId: string
29+
orgainzationId: string
3230
) => {
3331
const assigneeSettings = await prisma.user_Settings.findMany({ where: { userId: { in: assigneeIds } } });
3432
assigneeSettings.forEach(async (settings) => {
35-
if (settings.slackId && settings.userId !== assignerId) {
33+
if (settings.slackId) {
3634
await sendSlackTaskAssignedNotification(settings.slackId, task, orgainzationId);
3735
}
3836
});

0 commit comments

Comments
 (0)