From f47a633b8663df34507383a875b5bee30a09a2e9 Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 13 Jun 2024 15:32:39 +0700 Subject: [PATCH 1/4] fix: default notification to be hidden for new chat Signed-off-by: dominictb --- src/libs/ReportUtils.ts | 10 ++++++++-- src/libs/actions/Report.ts | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 914c653b6f91..d8d2d6cda404 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4602,7 +4602,13 @@ function buildOptimisticChatReport( return optimisticChatReport; } -function buildOptimisticGroupChatReport(participantAccountIDs: number[], reportName: string, avatarUri: string, optimisticReportID?: string) { +function buildOptimisticGroupChatReport( + participantAccountIDs: number[], + reportName: string, + avatarUri: string, + optimisticReportID?: string, + notificationPreference?: NotificationPreference, +) { return buildOptimisticChatReport( participantAccountIDs, reportName, @@ -4613,7 +4619,7 @@ function buildOptimisticGroupChatReport(participantAccountIDs: number[], reportN undefined, undefined, undefined, - undefined, + notificationPreference, undefined, undefined, undefined, diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 3adf48046936..c3d52e1c85f0 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -975,9 +975,20 @@ function navigateToAndOpenReport( if (isEmptyObject(chat)) { if (isGroupChat) { // If we are creating a group chat then participantAccountIDs is expected to contain currentUserAccountID - newChat = ReportUtils.buildOptimisticGroupChatReport(participantAccountIDs, reportName ?? '', avatarUri ?? '', optimisticReportID); + newChat = ReportUtils.buildOptimisticGroupChatReport(participantAccountIDs, reportName ?? '', avatarUri ?? '', optimisticReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); } else { - newChat = ReportUtils.buildOptimisticChatReport([...participantAccountIDs, currentUserAccountID]); + newChat = ReportUtils.buildOptimisticChatReport( + [...participantAccountIDs, currentUserAccountID], + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, + ); } } const report = isEmptyObject(chat) ? newChat : chat; From c90fb0b774abe3dba2acc5c824b0069ca6430ed9 Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 17 Jun 2024 14:51:31 +0700 Subject: [PATCH 2/4] chore: default "always" noti pref for created group chat Signed-off-by: dominictb --- src/libs/ReportUtils.ts | 3 +-- src/libs/actions/Report.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 36d2ebcf7c68..f59f2ebf6087 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4607,7 +4607,6 @@ function buildOptimisticGroupChatReport( reportName: string, avatarUri: string, optimisticReportID?: string, - notificationPreference?: NotificationPreference, ) { return buildOptimisticChatReport( participantAccountIDs, @@ -4619,7 +4618,7 @@ function buildOptimisticGroupChatReport( undefined, undefined, undefined, - notificationPreference, + undefined, undefined, undefined, undefined, diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 5902bd0af835..78df6fd4d9e0 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -975,7 +975,7 @@ function navigateToAndOpenReport( if (isEmptyObject(chat)) { if (isGroupChat) { // If we are creating a group chat then participantAccountIDs is expected to contain currentUserAccountID - newChat = ReportUtils.buildOptimisticGroupChatReport(participantAccountIDs, reportName ?? '', avatarUri ?? '', optimisticReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); + newChat = ReportUtils.buildOptimisticGroupChatReport(participantAccountIDs, reportName ?? '', avatarUri ?? '', optimisticReportID); } else { newChat = ReportUtils.buildOptimisticChatReport( [...participantAccountIDs, currentUserAccountID], From 18d54d95590db663084655dd17112dc039136d6b Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 17 Jun 2024 14:52:30 +0700 Subject: [PATCH 3/4] fix: prettier Signed-off-by: dominictb --- src/libs/ReportUtils.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f59f2ebf6087..5cdc9e71c54e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4602,12 +4602,7 @@ function buildOptimisticChatReport( return optimisticChatReport; } -function buildOptimisticGroupChatReport( - participantAccountIDs: number[], - reportName: string, - avatarUri: string, - optimisticReportID?: string, -) { +function buildOptimisticGroupChatReport(participantAccountIDs: number[], reportName: string, avatarUri: string, optimisticReportID?: string) { return buildOptimisticChatReport( participantAccountIDs, reportName, From 40ea884a45dc946052abf6e7ff08d80dff333dfe Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 20 Jun 2024 11:07:34 +0700 Subject: [PATCH 4/4] Revert "chore: default "always" noti pref for created group chat" This reverts commit c90fb0b774abe3dba2acc5c824b0069ca6430ed9. --- src/libs/ReportUtils.ts | 10 ++++++++-- src/libs/actions/Report.ts | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 5cdc9e71c54e..36d2ebcf7c68 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4602,7 +4602,13 @@ function buildOptimisticChatReport( return optimisticChatReport; } -function buildOptimisticGroupChatReport(participantAccountIDs: number[], reportName: string, avatarUri: string, optimisticReportID?: string) { +function buildOptimisticGroupChatReport( + participantAccountIDs: number[], + reportName: string, + avatarUri: string, + optimisticReportID?: string, + notificationPreference?: NotificationPreference, +) { return buildOptimisticChatReport( participantAccountIDs, reportName, @@ -4613,7 +4619,7 @@ function buildOptimisticGroupChatReport(participantAccountIDs: number[], reportN undefined, undefined, undefined, - undefined, + notificationPreference, undefined, undefined, undefined, diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 78df6fd4d9e0..5902bd0af835 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -975,7 +975,7 @@ function navigateToAndOpenReport( if (isEmptyObject(chat)) { if (isGroupChat) { // If we are creating a group chat then participantAccountIDs is expected to contain currentUserAccountID - newChat = ReportUtils.buildOptimisticGroupChatReport(participantAccountIDs, reportName ?? '', avatarUri ?? '', optimisticReportID); + newChat = ReportUtils.buildOptimisticGroupChatReport(participantAccountIDs, reportName ?? '', avatarUri ?? '', optimisticReportID, CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); } else { newChat = ReportUtils.buildOptimisticChatReport( [...participantAccountIDs, currentUserAccountID],