Skip to content

Commit fd407e2

Browse files
authored
Merge pull request #25618 from Expensify/chirag-hidden-notification
Return early for hidden notification preference
2 parents a906a7c + 74da686 commit fd407e2

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

src/CONST.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ const CONST = {
586586
MUTE: 'mute',
587587
DAILY: 'daily',
588588
ALWAYS: 'always',
589+
HIDDEN: 'hidden',
589590
},
590591
// Options for which room members can post
591592
WRITE_CAPABILITIES: {

src/components/LHNOptionsList/OptionRowLHN.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ function OptionRowLHN(props) {
7676
return null;
7777
}
7878

79-
const isMuted = optionItem.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE;
80-
if (isMuted && !props.isFocused && !optionItem.isPinned) {
79+
const isHidden = optionItem.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
80+
if (isHidden && !props.isFocused && !optionItem.isPinned) {
8181
return null;
8282
}
8383

src/libs/actions/Report.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,9 +1544,9 @@ function shouldShowReportActionNotification(reportID, action = null, isRemote =
15441544
return false;
15451545
}
15461546

1547-
// We don't want to send a local notification if the user preference is daily or mute
1547+
// We don't want to send a local notification if the user preference is daily, mute or hidden.
15481548
const notificationPreference = lodashGet(allReports, [reportID, 'notificationPreference'], CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS);
1549-
if (notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE || notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.DAILY) {
1549+
if (notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS) {
15501550
Log.info(`${tag} No notification because user preference is to be notified: ${notificationPreference}`);
15511551
return false;
15521552
}

src/pages/settings/Report/ReportSettingsPage.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ function ReportSettingsPage(props) {
6565

6666
const shouldDisableSettings = _.isEmpty(report) || ReportUtils.shouldDisableSettings(report) || ReportUtils.isArchivedRoom(report);
6767
const shouldShowRoomName = !ReportUtils.isPolicyExpenseChat(report) && !ReportUtils.isChatThread(report);
68-
const notificationPreference = translate(`notificationPreferencesPage.notificationPreferences.${report.notificationPreference}`);
68+
const notificationPreference =
69+
report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN
70+
? translate(`notificationPreferencesPage.notificationPreferences.${report.notificationPreference}`)
71+
: '';
6972
const writeCapability = ReportUtils.isAdminRoom(report) ? CONST.REPORT.WRITE_CAPABILITIES.ADMINS : report.writeCapability || CONST.REPORT.WRITE_CAPABILITIES.ALL;
7073

7174
const writeCapabilityText = translate(`writeCapabilityPage.writeCapability.${writeCapability}`);
@@ -79,12 +82,14 @@ function ReportSettingsPage(props) {
7982
onBackButtonPress={() => Navigation.goBack(ROUTES.getReportDetailsRoute(report.reportID))}
8083
/>
8184
<ScrollView style={[styles.flex1]}>
82-
<MenuItemWithTopDescription
83-
shouldShowRightIcon
84-
title={notificationPreference}
85-
description={translate('notificationPreferencesPage.label')}
86-
onPress={() => Navigation.navigate(ROUTES.getReportSettingsNotificationPreferencesRoute(report.reportID))}
87-
/>
85+
{report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN && (
86+
<MenuItemWithTopDescription
87+
shouldShowRightIcon
88+
title={notificationPreference}
89+
description={translate('notificationPreferencesPage.label')}
90+
onPress={() => Navigation.navigate(ROUTES.getReportSettingsNotificationPreferencesRoute(report.reportID))}
91+
/>
92+
)}
8893
{shouldShowRoomName && (
8994
<OfflineWithFeedback
9095
pendingAction={lodashGet(report, 'pendingFields.reportName', null)}

0 commit comments

Comments
 (0)