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
2 changes: 2 additions & 0 deletions src/components/ChronosTimerHeaderButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function ChronosTimerHeaderButton({report}: ChronosTimerHeaderButtonProps) {
const isReportArchived = useReportIsArchived(report?.reportID);
const canPerformWriteAction = canUserPerformWriteAction(report, isReportArchived);
const [visibleReportActionsData] = useOnyx(ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

const {accountID: currentUserAccountID, timezone: timezoneParam} = useCurrentUserPersonalDetails();
const reportActionsOnyxKey = `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}` as OnyxKey;
Expand Down Expand Up @@ -92,6 +93,7 @@ function ChronosTimerHeaderButton({report}: ChronosTimerHeaderButtonProps) {
shouldPlaySound: false,
isInSidePanel,
delegateAccountID,
conciergeReportID,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ function MoneyRequestReceiptView({
currentUserAccountID,
timezone: currentUserTimezone,
delegateAccountID,
conciergeReportID,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to k2s

});
};

Expand Down
1 change: 1 addition & 0 deletions src/components/Search/SearchRouter/useAskConcierge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function useAskConcierge() {
shouldPlaySound: true,
isInSidePanel,
delegateAccountID,
conciergeReportID,
});
};

Expand Down
19 changes: 17 additions & 2 deletions src/libs/actions/Report/SuggestedFollowup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const CONCIERGE_RESPONSE_DELAY_MS = 4000;
* @param reportAction - The report action containing the followup-list
* @param selectedFollowup - The followup object containing the question text and optional pre-generated response
* @param timezoneParam - The user's timezone
* @param conciergeReportID - The Concierge report ID, used to detect whether the comment is posted in the Concierge chat
* @param ancestors - Array of ancestor reports for proper threading
*/
function resolveSuggestedFollowup(
Expand All @@ -40,6 +41,7 @@ function resolveSuggestedFollowup(
currentUserAccountID: number,
currentUserEmail: string | undefined,
delegateAccountID: number | undefined,
conciergeReportID: string | undefined,
ancestors: Ancestor[] = [],
) {
const reportID = report?.reportID;
Expand Down Expand Up @@ -69,7 +71,16 @@ function resolveSuggestedFollowup(
});

if (!selectedFollowup.response) {
addComment({report, notifyReportID: notifyReportID ?? reportID, ancestors, text: selectedFollowup.text, timezoneParam, currentUserAccountID, delegateAccountID});
addComment({
report,
notifyReportID: notifyReportID ?? reportID,
ancestors,
text: selectedFollowup.text,
timezoneParam,
currentUserAccountID,
delegateAccountID,
conciergeReportID,
});
return;
}

Expand All @@ -91,6 +102,7 @@ function resolveSuggestedFollowup(
pregeneratedResponse: selectedFollowup.response,
},
delegateAccountID,
conciergeReportID,
});

// Use the full delay as createdOffset so the Concierge response timestamp is
Expand Down Expand Up @@ -177,7 +189,10 @@ function applyPendingConciergeAction(reportID: string | undefined, reportAction:
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.CONCIERGE_PENDING_FOLLOWUP_LIST}${reportID}`,
value: {reportActionID: reportAction.reportActionID, createdAt: Date.now()},
value: {
reportActionID: reportAction.reportActionID,
createdAt: Date.now(),
},
},
]);
}
Expand Down
33 changes: 29 additions & 4 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ type AddCommentParams = {
pregeneratedResponseParams?: PregeneratedResponseParams;
reportActionID?: string;
delegateAccountID: number | undefined;
conciergeReportID: string | undefined;
};

type AddActionsParams = {
Expand All @@ -396,6 +397,7 @@ type AddActionsParams = {
pregeneratedResponseParams?: PregeneratedResponseParams;
reportActionID?: string;
delegateAccountID: number | undefined;
conciergeReportID: string | undefined;
};

type AddAttachmentWithCommentParams = {
Expand All @@ -410,6 +412,7 @@ type AddAttachmentWithCommentParams = {
isInSidePanel?: boolean;
delegateAccountID: number | undefined;
sidePanelContext?: SidePanelContext;
conciergeReportID: string | undefined;
};

const addNewMessageWithText = new Set<string>([WRITE_COMMANDS.ADD_COMMENT, WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT]);
Expand Down Expand Up @@ -839,6 +842,7 @@ function addActions({
pregeneratedResponseParams,
reportActionID,
delegateAccountID,
conciergeReportID,
}: AddActionsParams) {
if (!report?.reportID) {
return;
Expand Down Expand Up @@ -962,7 +966,7 @@ function addActions({
idempotencyKey: Str.guid(),
};

const isConciergeChat = isConciergeChatReport(reportForAction);
const isConciergeChat = isConciergeChatReport(reportForAction, conciergeReportID);
if (reportIDDeeplinkedFromOldDot === reportID && isConciergeChat) {
parameters.isOldDotConciergeChat = true;
}
Expand Down Expand Up @@ -1108,6 +1112,7 @@ function addAttachmentWithComment({
isInSidePanel = false,
delegateAccountID,
sidePanelContext,
conciergeReportID,
}: AddAttachmentWithCommentParams) {
if (!report?.reportID) {
return;
Expand All @@ -1122,13 +1127,25 @@ function addAttachmentWithComment({

// Single attachment
if (!Array.isArray(attachments)) {
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments, isInSidePanel, delegateAccountID, sidePanelContext});
addActions({
report,
notifyReportID,
ancestors,
timezoneParam: timezone,
currentUserAccountID,
text,
file: attachments,
isInSidePanel,
delegateAccountID,
sidePanelContext,
conciergeReportID,
});
handlePlaySound();
return;
}

// Multiple attachments - first: combine text + first attachment as a single action
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments?.at(0), isInSidePanel, delegateAccountID});
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments?.at(0), isInSidePanel, delegateAccountID, conciergeReportID});

// Remaining: attachment-only actions (no text duplication)
for (let i = 1; i < attachments?.length; i += 1) {
Expand All @@ -1143,6 +1160,7 @@ function addAttachmentWithComment({
isInSidePanel,
delegateAccountID,
sidePanelContext,
conciergeReportID,
});
}

Expand All @@ -1164,6 +1182,7 @@ function addComment({
pregeneratedResponseParams,
reportActionID,
delegateAccountID,
conciergeReportID,
}: AddCommentParams) {
if (shouldPlaySound) {
playSound(SOUNDS.DONE);
Expand All @@ -1180,6 +1199,7 @@ function addComment({
reportActionID,
delegateAccountID,
sidePanelContext,
conciergeReportID,
});
}

Expand Down Expand Up @@ -2617,6 +2637,8 @@ function explain(
currentUserAccountID,
shouldPlaySound: true,
delegateAccountID,
// Safe: the explanation posts to a thread, never the Concierge chat. Thread it if #66411 removes the fallback.
conciergeReportID: undefined,
Comment thread
cretadn22 marked this conversation as resolved.
});
});
}
Expand Down Expand Up @@ -5085,6 +5107,8 @@ function inviteToRoomAction(
currentUserAccountID,
shouldPlaySound: false,
delegateAccountID,
// Safe: this posts to the room, never the Concierge chat. Thread it if #66411 removes the fallback.
conciergeReportID: undefined,
});
}

Expand Down Expand Up @@ -7840,7 +7864,8 @@ function resolveConciergeOptions(
}

const reportID = report.reportID;
addComment({report, notifyReportID: notifyReportID ?? reportID, ancestors, text: selectedValue, timezoneParam, currentUserAccountID, delegateAccountID});
// Must thread before #66411 removes the fallback: this report CAN be the Concierge chat, so undefined would drop Concierge params.
addComment({report, notifyReportID: notifyReportID ?? reportID, ancestors, text: selectedValue, timezoneParam, currentUserAccountID, delegateAccountID, conciergeReportID: undefined});
Comment thread
cretadn22 marked this conversation as resolved.

Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[reportActionID]: {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/ChronosScheduleOOOPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function ChronosScheduleOOOPage({route}: ChronosScheduleOOOPageProps) {
const delegateAccountID = useDelegateAccountID();

const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [isDurationUnitModalVisible, setIsDurationUnitModalVisible] = useState(false);
const [selectedDurationUnit, setSelectedDurationUnit] = useState<string>(CONST.CHRONOS.OOO_DURATION_UNITS.DAY);
const ancestors = useAncestors(report);
Expand Down Expand Up @@ -115,6 +116,7 @@ function ChronosScheduleOOOPage({route}: ChronosScheduleOOOPageProps) {
shouldPlaySound: false,
isInSidePanel,
delegateAccountID,
conciergeReportID,
});

Navigation.goBack();
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Share/ShareDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) {
const [validatedFile] = useOnyx(ONYXKEYS.VALIDATED_FILE_OBJECT);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const delegateAccountID = useDelegateAccountID();

const reportAttributesDerived = useReportAttributes();
Expand Down Expand Up @@ -138,6 +139,7 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) {
timezoneParam: personalDetail.timezone ?? CONST.DEFAULT_TIME_ZONE,
currentUserAccountID: personalDetail.accountID,
delegateAccountID,
conciergeReportID,
});
const routeToNavigate = ROUTES.REPORT_WITH_ID.getRoute(reportOrAccountID);
Navigation.revealRouteBeforeDismissingModal(routeToNavigate);
Expand Down Expand Up @@ -173,6 +175,7 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) {
text: message,
timezone: personalDetail.timezone,
delegateAccountID,
conciergeReportID,
});
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/Travel/DynamicTravelTerms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ function DynamicTravelTerms({route}: TravelTermsPageProps) {
timezoneParam: CONST.DEFAULT_TIME_ZONE,
currentUserAccountID,
delegateAccountID,
conciergeReportID,
});
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(conciergeReportID));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function useComposerSubmit(reportID: string) {
const isInSidePanel = useIsInSidePanel();
const sidePanelContext = useSidePanelContext(reportID);
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [isComposerFullSize = false] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${reportID}`);
const delegateAccountID = useDelegateAccountID();
const {kickoffWaitingIndicator} = useAgentZeroStatusActions();
Expand Down Expand Up @@ -89,6 +90,7 @@ function useComposerSubmit(reportID: string) {
isInSidePanel,
delegateAccountID,
sidePanelContext,
conciergeReportID,
});
attachmentFileRef.current = null;
return;
Expand Down Expand Up @@ -172,6 +174,7 @@ function useComposerSubmit(reportID: string) {
sidePanelContext,
reportActionID: optimisticReportActionID,
delegateAccountID,
conciergeReportID,
});
};

Expand Down
13 changes: 11 additions & 2 deletions src/pages/inbox/report/actionContents/ChatActionableButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ function ChatActionableButtons({action, originalReportID, reportID, hasPendingFo
const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy();
const activePolicy = useActivePolicy();

const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector});
const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {
selector: validTransactionDraftIDsSelector,
});
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
Expand All @@ -68,6 +70,7 @@ function ChatActionableButtons({action, originalReportID, reportID, hasPendingFo
const firstPolicyID = filteredPoliciesInfo?.firstPolicyID;
const trackExpenseTransactionID = isActionableTrackExpense(action) ? getOriginalMessage(action)?.transactionID : undefined;
const [trackExpenseTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(trackExpenseTransactionID)}`);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const delegateAccountID = useDelegateAccountID();

const actionableItemButtons = ((): ActionableItem[] => {
Expand Down Expand Up @@ -163,6 +166,7 @@ function ChatActionableButtons({action, originalReportID, reportID, hasPendingFo
personalDetail.accountID,
personalDetail.email,
delegateAccountID,
conciergeReportID,
);
},
}));
Expand Down Expand Up @@ -202,7 +206,12 @@ function ChatActionableButtons({action, originalReportID, reportID, hasPendingFo
});
},
});
const options = [prepareTrackExpenseButton('submit', {isRestrictedToPreferredPolicy, preferredPolicyID})];
const options = [
prepareTrackExpenseButton('submit', {
isRestrictedToPreferredPolicy,
preferredPolicyID,
}),
];

if (Permissions.canUseTrackFlows()) {
options.push(prepareTrackExpenseButton('categorize'), prepareTrackExpenseButton('share'));
Expand Down
Loading
Loading