Skip to content

Commit

Permalink
Merge pull request #51425 from callstack-internal/pac-guerreiro/fix/5…
Browse files Browse the repository at this point in the history
…1271-debug-mode-for-inbox-tab-gbr-doesnt-handle-multi-policy

Debug mode for Inbox tab GBR doesn't handle multi-policy
  • Loading branch information
puneetlath authored Nov 5, 2024
2 parents 4833a6c + d6da63d commit 5a63cc5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5147,6 +5147,7 @@ const translations = {
RBR: 'RBR',
true: 'true',
false: 'false',
viewReport: 'View Report',
reasonVisibleInLHN: {
hasDraftComment: 'Has draft comment',
hasGBR: 'Has GBR',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5662,6 +5662,7 @@ const translations = {
RBR: 'RBR',
true: 'verdadero',
false: 'falso',
viewReport: 'Ver Informe',
reasonVisibleInLHN: {
hasDraftComment: 'Tiene comentario en borrador',
hasGBR: 'Tiene GBR',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function DebugTabView({selectedTab = '', chatTabBrickRoad, activeWorkspaceID}: D
const report = getChatTabBrickRoadReport(activeWorkspaceID);

if (report) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
Navigation.navigate(ROUTES.DEBUG_REPORT.getRoute(report.reportID));
}
}
if (selectedTab === SCREENS.SETTINGS.ROOT) {
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Debug/DebugDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import type {ObjectType, OnyxDataType} from '@libs/DebugUtils';
import DebugUtils from '@libs/DebugUtils';
import Navigation from '@libs/Navigation/Navigation';
import Debug from '@userActions/Debug';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -236,7 +235,6 @@ function DebugDetails({data, children, onSave, onDelete, validate}: DebugDetails
text={translate('common.delete')}
onPress={() => {
onDelete();
Navigation.goBack();
}}
/>
</View>
Expand Down
15 changes: 15 additions & 0 deletions src/pages/Debug/Report/DebugReportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import ScreenWrapper from '@components/ScreenWrapper';
import TabSelector from '@components/TabSelector/TabSelector';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {navigateToConciergeChatAndDeleteReport} from '@libs/actions/Report';
import DebugUtils from '@libs/DebugUtils';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import Navigation from '@libs/Navigation/Navigation';
Expand All @@ -19,6 +21,7 @@ import type {DebugParamList} from '@libs/Navigation/types';
import * as ReportUtils from '@libs/ReportUtils';
import DebugDetails from '@pages/Debug/DebugDetails';
import DebugJSON from '@pages/Debug/DebugJSON';
import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import Debug from '@userActions/Debug';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -112,6 +115,10 @@ function DebugReportPage({
];
}, [parentReportAction, report, reportActions, reportID, transactionViolations, translate]);

if (!report) {
return <NotFoundPage />;
}

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand All @@ -138,6 +145,7 @@ function DebugReportPage({
}}
onDelete={() => {
Debug.mergeDebugData(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, null);
navigateToConciergeChatAndDeleteReport(reportID, true, true);
}}
validate={DebugUtils.validateReportDraftProperty}
>
Expand All @@ -157,6 +165,13 @@ function DebugReportPage({
)}
</View>
))}
<Button
text={translate('debug.viewReport')}
onPress={() => {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID));
}}
icon={Expensicons.Eye}
/>
</View>
</DebugDetails>
)}
Expand Down
1 change: 1 addition & 0 deletions src/pages/Debug/ReportAction/DebugReportActionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function DebugReportActionPage({
}}
onDelete={() => {
Debug.mergeDebugData(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {[reportActionID]: null});
Navigation.goBack();
}}
validate={DebugUtils.validateReportActionDraftProperty}
/>
Expand Down

0 comments on commit 5a63cc5

Please sign in to comment.