Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
// map of reportID to all reportActions for that report
const allReportActions: OnyxCollection<ReportActions> = {};

Onyx.connect({

Check warning on line 376 in src/libs/actions/Report/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
callback: (actions, key) => {
if (!key || !actions) {
Expand All @@ -385,7 +385,7 @@
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 388 in src/libs/actions/Report/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -394,7 +394,7 @@
});

let allPersonalDetails: OnyxEntry<PersonalDetailsList> = {};
Onyx.connect({

Check warning on line 397 in src/libs/actions/Report/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand All @@ -412,7 +412,7 @@
});

let onboarding: OnyxEntry<Onboarding>;
Onyx.connect({

Check warning on line 415 in src/libs/actions/Report/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ONBOARDING,
callback: (val) => {
if (Array.isArray(val)) {
Expand Down Expand Up @@ -2098,8 +2098,9 @@
parentReport: OnyxEntry<Report>,
currentUserAccountID: number,
introSelected: OnyxEntry<IntroSelected>,
betas: OnyxEntry<Beta[]>,
) {
const report = childReport ?? createChildReport(childReport, parentReportAction, parentReport, currentUserAccountID, introSelected);
const report = childReport ?? createChildReport(childReport, parentReportAction, parentReport, currentUserAccountID, introSelected, betas);

Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID, undefined, undefined, Navigation.getActiveRoute()));
}
Expand All @@ -2115,6 +2116,7 @@
parentReport: OnyxEntry<Report>,
currentUserAccountID: number,
introSelected: OnyxEntry<IntroSelected>,
betas: OnyxEntry<Beta[]>,
): Report {
const participantAccountIDs = [...new Set([currentUserAccountID, Number(parentReportAction.actorAccountID)])];
// Threads from DMs and selfDMs don't have a chatType. All other threads inherit the chatType from their parent
Expand Down Expand Up @@ -2142,6 +2144,7 @@
newReportObject: newChat,
parentReportActionID: parentReportAction.reportActionID,
isNewThread: true,
betas,
});
} else {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${childReportID}`, newChat);
Expand All @@ -2161,14 +2164,15 @@
translate: LocalizedTranslate,
currentUserAccountID: number,
introSelected: OnyxEntry<IntroSelected>,
betas: OnyxEntry<Beta[]>,
timezone: Timezone = CONST.DEFAULT_TIME_ZONE,
) {
if (!originalReport?.reportID || !reportAction) {
return;
}

// Check if explanation thread report already exists
const report = childReport ?? createChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected);
const report = childReport ?? createChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas);

Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID, undefined, undefined, Navigation.getActiveRoute()));
// Schedule adding the explanation comment on the next animation frame
Expand Down Expand Up @@ -2948,10 +2952,11 @@
parentReportAction: ReportAction,
parentReport: OnyxEntry<Report>,
introSelected: OnyxEntry<IntroSelected>,
betas: OnyxEntry<Beta[]>,
prevNotificationPreference?: NotificationPreference,
) {
if (childReportID) {
openReport({reportID: childReportID, introSelected});
openReport({reportID: childReportID, introSelected, betas});
const parentReportActionID = parentReportAction.reportActionID;
if (!prevNotificationPreference || isHiddenForCurrentUser(prevNotificationPreference)) {
updateNotificationPreference(
Expand Down Expand Up @@ -2992,6 +2997,7 @@
participantLoginList: participantLogins,
newReportObject: newChat,
parentReportActionID: parentReportAction.reportActionID,
betas,
});
const notificationPreference = isHiddenForCurrentUser(prevNotificationPreference) ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
updateNotificationPreference(newChat.reportID, prevNotificationPreference, notificationPreference, currentUserAccountID, parentReport?.reportID, parentReportAction.reportActionID);
Expand Down
24 changes: 12 additions & 12 deletions src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,16 @@ const ContextMenuActions: ContextMenuAction[] = [
}
return !shouldDisableThread(reportAction, isThreadReportParentAction, isArchivedRoom);
},
onPress: (closePopover, {reportAction, childReport, originalReport, currentUserAccountID, introSelected}) => {
onPress: (closePopover, {reportAction, childReport, originalReport, currentUserAccountID, introSelected, betas}) => {
if (closePopover) {
hideContextMenu(false, () => {
KeyboardUtils.dismiss().then(() => {
navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected);
navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas);
});
});
return;
}
navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected);
navigateToAndOpenChildReport(childReport, reportAction, originalReport, currentUserAccountID, introSelected, betas);
},
getDescription: () => {},
sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.REPLY_IN_THREAD,
Expand Down Expand Up @@ -471,21 +471,21 @@ const ContextMenuActions: ContextMenuAction[] = [

return hasReasoning(reportAction);
},
onPress: (closePopover, {reportAction, childReport, originalReport, translate, currentUserPersonalDetails, introSelected}) => {
onPress: (closePopover, {reportAction, childReport, originalReport, translate, currentUserPersonalDetails, introSelected, betas}) => {
if (!originalReport?.reportID) {
return;
}

if (closePopover) {
hideContextMenu(false, () => {
KeyboardUtils.dismiss().then(() => {
explain(childReport, originalReport, reportAction, translate, currentUserPersonalDetails.accountID, introSelected, currentUserPersonalDetails?.timezone);
explain(childReport, originalReport, reportAction, translate, currentUserPersonalDetails.accountID, introSelected, betas, currentUserPersonalDetails?.timezone);
});
});
return;
}

explain(childReport, originalReport, reportAction, translate, currentUserPersonalDetails.accountID, introSelected, currentUserPersonalDetails?.timezone);
explain(childReport, originalReport, reportAction, translate, currentUserPersonalDetails.accountID, introSelected, betas, currentUserPersonalDetails?.timezone);
},
getDescription: () => {},
sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.EXPLAIN,
Expand Down Expand Up @@ -626,18 +626,18 @@ const ContextMenuActions: ContextMenuAction[] = [
(shouldDisplayThreadReplies || (!isDeletedAction && !isArchivedRoom))
);
},
onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected}) => {
onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected, betas}) => {
const childReportNotificationPreference = getChildReportNotificationPreferenceReportUtils(reportAction);
if (closePopover) {
hideContextMenu(false, () => {
ReportActionComposeFocusManager.focus();
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, childReportNotificationPreference);
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, betas, childReportNotificationPreference);
});
return;
}

ReportActionComposeFocusManager.focus();
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, childReportNotificationPreference);
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, betas, childReportNotificationPreference);
},
getDescription: () => {},
sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.JOIN_THREAD,
Expand Down Expand Up @@ -665,18 +665,18 @@ const ContextMenuActions: ContextMenuAction[] = [
(shouldDisplayThreadReplies || (!isDeletedAction && !isArchivedRoom))
);
},
onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected}) => {
onPress: (closePopover, {reportAction, currentUserAccountID, originalReport, introSelected, betas}) => {
const childReportNotificationPreference = getChildReportNotificationPreferenceReportUtils(reportAction);
if (closePopover) {
hideContextMenu(false, () => {
ReportActionComposeFocusManager.focus();
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, childReportNotificationPreference);
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, betas, childReportNotificationPreference);
});
return;
}

ReportActionComposeFocusManager.focus();
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, childReportNotificationPreference);
toggleSubscribeToChildReport(reportAction?.childReportID, currentUserAccountID, reportAction, originalReport, introSelected, betas, childReportNotificationPreference);
},
getDescription: () => {},
sentryLabel: CONST.SENTRY_LABEL.CONTEXT_MENU.LEAVE_THREAD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ function ReportActionItemMessageWithExplain({message, action, childReport, origi
const personalDetail = useCurrentUserPersonalDetails();
const {environmentURL} = useEnvironment();
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [betas] = useOnyx(ONYXKEYS.BETAS);

const actionHasReasoning = hasReasoning(action);
const computedMessage = actionHasReasoning ? `${message}${translate('iou.AskToExplain')}` : message;

const handleLinkPress = (event: GestureResponderEvent | KeyboardEvent, href: string) => {
// Handle the special "Explain" link
if (href.endsWith(CONST.CONCIERGE_EXPLAIN_LINK_PATH)) {
explain(childReport, originalReport, action, translate, personalDetail.accountID, introSelected, personalDetail?.timezone);
explain(childReport, originalReport, action, translate, personalDetail.accountID, introSelected, betas, personalDetail?.timezone);
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/pages/inbox/report/ReportActionItemThread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function ReportActionItemThread({
const {translate, datetimeToCalendarTime} = useLocalize();
const [childReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportAction.childReportID}`);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [betas] = useOnyx(ONYXKEYS.BETAS);

const numberOfRepliesText = numberOfReplies > CONST.MAX_THREAD_REPLIES_PREVIEW ? `${CONST.MAX_THREAD_REPLIES_PREVIEW}+` : `${numberOfReplies}`;
const replyText = numberOfReplies === 1 ? translate('threads.reply') : translate('threads.replies');
Expand All @@ -68,7 +69,7 @@ function ReportActionItemThread({
<View style={[styles.chatItemMessage]}>
<PressableWithSecondaryInteraction
onPress={() => {
navigateToAndOpenChildReport(childReport, reportAction, report, currentUserAccountID, introSelected);
navigateToAndOpenChildReport(childReport, reportAction, report, currentUserAccountID, introSelected, betas);
}}
role={CONST.ROLE.BUTTON}
accessibilityLabel={`${numberOfReplies} ${replyText}`}
Expand Down
Loading
Loading