From f78903e679db0335a914451a681e60ad9455ce23 Mon Sep 17 00:00:00 2001 From: JAESEON PARK Date: Thu, 13 Aug 2026 02:50:55 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20org=20=EC=A0=80=EC=9E=A5=EC=8B=9C=20aler?= =?UTF-8?q?t=20draft=20=EA=B0=92=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/setting/useSettingNotifications.ts | 69 +++++++++++++------- src/hooks/setting/useSettingSave.ts | 22 ++++--- 2 files changed, 61 insertions(+), 30 deletions(-) diff --git a/src/hooks/setting/useSettingNotifications.ts b/src/hooks/setting/useSettingNotifications.ts index f532a6ec..620aac6f 100644 --- a/src/hooks/setting/useSettingNotifications.ts +++ b/src/hooks/setting/useSettingNotifications.ts @@ -86,6 +86,7 @@ export default function useSettingNotifications() { (isNotificationLoading || isNotificationRefetching); const buildOrgBody = ( + alerts: { alertClicks: boolean; alertReport: boolean }, overrides: Partial = {}, ): IUpdateOrgNotificationSettingsRequest => ({ isSlackEnabled: savedOrgNotif.slackEnabled, @@ -94,8 +95,8 @@ export default function useSettingNotifications() { isDiscordEnabled: savedOrgNotif.discordEnabled, discordWebhookUrl: "", disconnectDiscord: false, - alertClicks: savedWorkspaceNotif.clickAlarm ?? false, - alertReport: savedWorkspaceNotif.weeklyReport ?? false, + alertClicks: alerts.alertClicks, + alertReport: alerts.alertReport, ...overrides, }); @@ -121,11 +122,17 @@ export default function useSettingNotifications() { setPendingOrgAction("slack"); try { await updateOrg.mutateAsync( - buildOrgBody({ - isSlackEnabled: true, - slackWebhookUrl: url, - disconnectSlack: false, - }), + buildOrgBody( + { + alertClicks: draftWorkspaceNotif.clickAlarm, + alertReport: draftWorkspaceNotif.weeklyReport, + }, + { + isSlackEnabled: true, + slackWebhookUrl: url, + disconnectSlack: false, + }, + ), ); toast.success("슬랙이 연동되었습니다"); setSlackWebhookUrl(""); @@ -142,11 +149,17 @@ export default function useSettingNotifications() { setPendingOrgAction("slack"); try { await updateOrg.mutateAsync( - buildOrgBody({ - isSlackEnabled: false, - slackWebhookUrl: "", - disconnectSlack: true, - }), + buildOrgBody( + { + alertClicks: draftWorkspaceNotif.clickAlarm, + alertReport: draftWorkspaceNotif.weeklyReport, + }, + { + isSlackEnabled: false, + slackWebhookUrl: "", + disconnectSlack: true, + }, + ), ); toast.success("슬랙 연동이 해제되었습니다"); } catch (e) { @@ -171,11 +184,17 @@ export default function useSettingNotifications() { setPendingOrgAction("discord"); try { await updateOrg.mutateAsync( - buildOrgBody({ - isDiscordEnabled: true, - discordWebhookUrl: url, - disconnectDiscord: false, - }), + buildOrgBody( + { + alertClicks: draftWorkspaceNotif.clickAlarm, + alertReport: draftWorkspaceNotif.weeklyReport, + }, + { + isDiscordEnabled: true, + discordWebhookUrl: url, + disconnectDiscord: false, + }, + ), ); toast.success("디스코드가 연동되었습니다"); setDiscordWebhookUrl(""); @@ -192,11 +211,17 @@ export default function useSettingNotifications() { setPendingOrgAction("discord"); try { await updateOrg.mutateAsync( - buildOrgBody({ - isDiscordEnabled: false, - discordWebhookUrl: "", - disconnectDiscord: true, - }), + buildOrgBody( + { + alertClicks: draftWorkspaceNotif.clickAlarm, + alertReport: draftWorkspaceNotif.weeklyReport, + }, + { + isDiscordEnabled: false, + discordWebhookUrl: "", + disconnectDiscord: true, + }, + ), ); toast.success("디스코드 연동이 해제되었습니다"); } catch (e) { diff --git a/src/hooks/setting/useSettingSave.ts b/src/hooks/setting/useSettingSave.ts index a1fa0ca3..f661fa43 100644 --- a/src/hooks/setting/useSettingSave.ts +++ b/src/hooks/setting/useSettingSave.ts @@ -131,14 +131,20 @@ export default function useSettingSave({ } if (shouldSaveOrg) { await notifications.updateOrg.mutateAsync( - notifications.buildOrgBody({ - isSlackEnabled: notifications.draftOrgNotif.slackEnabled, - slackWebhookUrl: "", - disconnectSlack: false, - isDiscordEnabled: notifications.draftOrgNotif.discordEnabled, - discordWebhookUrl: "", - disconnectDiscord: false, - }), + notifications.buildOrgBody( + { + alertClicks: notifications.draftWorkspaceNotif.clickAlarm, + alertReport: notifications.draftWorkspaceNotif.weeklyReport, + }, + { + isSlackEnabled: notifications.draftOrgNotif.slackEnabled, + slackWebhookUrl: "", + disconnectSlack: false, + isDiscordEnabled: notifications.draftOrgNotif.discordEnabled, + discordWebhookUrl: "", + disconnectDiscord: false, + }, + ), ); notifications.setSavedOrgNotif((prev) => ({ ...prev,