Skip to content

Commit 296b450

Browse files
committed
#3945 don't send slack notif when user is assignee
1 parent 34c4bfb commit 296b450

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

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

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

123123
const newTask = taskTransformer(createdTask);
124124

125-
await sendSlackTaskAssignedNotificationToUsers(newTask, assignees, organization.organizationId);
125+
await sendSlackTaskAssignedNotificationToUsers(newTask, assignees, organization.organizationId, createdBy.userId);
126126

127127
return newTask;
128128
}
@@ -254,7 +254,7 @@ export default class TasksService {
254254
})
255255
);
256256

257-
await sendSlackTaskAssignedNotificationToUsers(updatedTask, newAssigneeIds, organization.organizationId);
257+
await sendSlackTaskAssignedNotificationToUsers(updatedTask, newAssigneeIds, organization.organizationId, user.userId);
258258

259259
return updatedTask;
260260
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ 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
2526
*/
2627
export const sendSlackTaskAssignedNotificationToUsers = async (
2728
task: Task,
2829
assigneeIds: string[],
29-
orgainzationId: string
30+
orgainzationId: string,
31+
assignerId: string
3032
) => {
3133
const assigneeSettings = await prisma.user_Settings.findMany({ where: { userId: { in: assigneeIds } } });
3234
assigneeSettings.forEach(async (settings) => {
33-
if (settings.slackId) {
35+
if (settings.slackId && settings.userId !== assignerId) {
3436
await sendSlackTaskAssignedNotification(settings.slackId, task, orgainzationId);
3537
}
3638
});

0 commit comments

Comments
 (0)