App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Vacation delegate - Link to the Submitter's workspace chat appears for the Vacation delegate

Open mitarachim opened this issue 2 months ago • 32 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.2.43-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1739/folder/13176687/41236712/991933288?sort=%2Bidentifier&p=2 Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Device used: Mac 15.4.1 Safari, Desktop, iPhone 13 iOS 18.6.2 Safari, Hybrid App Component: Chat Report View

Action Performed:

Preconditions: Use only expensifail account and don't use gmail account 4 accounts are needed for this TC:

Account A: Workspace owner (should invite folowing accounts) Account B: Workspace approver (Should set an Account C as Vacation delegate) Account C: Vacation delegate Account D: Workspace submitter

  1. Navigate to https://staging.new.expensify.com
  2. As account D (submitter), submit an expense to the workspace chat
  3. Log in as Account C (vacation delegate)
  4. Go to any report that needs to be approved by Account B
  5. Click on the Report to view the details
  6. Click on the "More"
  7. Click on the "Split" option
  8. Verify Two new expenses are created and the amount is equally split
  9. Click on the "Save" button
  10. Click on the from link in the header

Expected Result:

The link to the Submitter's workspace chat should not appear for the Vacation delegate

Actual Result:

After splitting expense, the Vacation delegate sees the link to the Submitter's workspace chat, which leads to the Not here page, then the link disappears from the expense report header. In the IOS hybrid app, the Vacation delegate sees the link after opening the submitted expense.

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [x] iOS: App
  • [x] iOS: mWeb Safari
  • [x] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/3c9101e1-f543-4ecb-87ce-22e798275908

https://github.com/user-attachments/assets/816270fc-21d8-4f3c-af24-b0b3aa5d45ee

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021986269930728379444
  • Upwork Job ID: 1986269930728379444
  • Last Price Increase: 2025-12-25
Issue OwnerCurrent Issue Owner: @suneox

mitarachim avatar Nov 04 '25 06:11 mitarachim

Triggered auto assignment to @RachCHopkins (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Nov 04 '25 06:11 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

Vacation delegate - Link to the Submitter's workspace chat appears for the Vacation delegate

What is the root cause of that problem?

The issue was that when a vacation delegate splits an expense, the optimistic transaction thread reports were created without the hasParentAccess field being set. This caused the vacation delegate to temporarily see a link to the submitter's workspace chat (which they don't have access to) until the backend returned the correct value.

https://github.com/Expensify/App/blob/03bd81d3219cb20060840edf1e951e2c0df9f182/src/libs/ReportUtils.ts#L8394-L8423

What changes do you think we should make in order to solve the problem?

We should determine if the current user has access to the parent report (workspace chat)

  • If the money request report has a policyID, check if the current user is a member of that policy
  • If they're not a member (e.g., vacation delegate), set hasParentAccess to false
    let hasParentAccess: boolean | undefined;
    if (moneyRequestReport?.policyID) {
        const policy = getPolicy(moneyRequestReport.policyID);
        const currentUserLogin = currentUserPersonalDetails?.login;

        // Check if the current user is a member of the policy
        // If not, they don't have access to the parent workspace chat
        if (currentUserLogin && !isPolicyMember(policy, currentUserLogin)) {
            hasParentAccess = false;
        }
    }

    // We can move the  `hasParentAccess` logic inside `buildOptimisticChatReport` if needed
    const optimisticReport = buildOptimisticChatReport({
        participantList: participantAccountIDs,
        reportName: getTransactionReportName({reportAction}),
        policyID: moneyRequestReport?.policyID,
        ownerAccountID: CONST.POLICY.OWNER_ACCOUNT_ID_FAKE,
        notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
        parentReportActionID: reportAction?.reportActionID,
        parentReportID: moneyRequestReport?.reportID,
        optimisticReportID: optimisticTransactionThreadReportID,
    });

    // Set hasParentAccess if determined
    if (hasParentAccess !== undefined) {
        optimisticReport.hasParentAccess = hasParentAccess;
    }

    return optimisticReport;

https://github.com/Expensify/App/blob/03bd81d3219cb20060840edf1e951e2c0df9f182/src/libs/ReportUtils.ts#L8413-L8422

We need to add hasParentAccess type to OptimisticChatReport as well

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

lorretheboy avatar Nov 04 '25 10:11 lorretheboy

Ok, so if we need 4 accounts to repro, I will assume that none of the approvers are workspace admins. So we need 3 non-admin accounts and an approval workflow:

  1. Submitter
  2. Approver of submitter, with a vacation delegate enabled
  3. The vacation delegate

Yes, can repro faithfully. I can see the link and click into it when I am the regular approver, however I agree that a vacation delegate should not have access to the user's full expense history.

RachCHopkins avatar Nov 06 '25 03:11 RachCHopkins

Job added to Upwork: https://www.upwork.com/jobs/~021986269930728379444

melvin-bot[bot] avatar Nov 06 '25 03:11 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (External)

melvin-bot[bot] avatar Nov 06 '25 03:11 melvin-bot[bot]

@lorretheboy Thanks for your proposal, but it looks like fixing it only when building the optimistic data isn’t enough — the issue still occurs when the user re-signs in or clear cache

https://github.com/user-attachments/assets/a98f30ae-f298-4169-89a2-f27b7723c1a0

suneox avatar Nov 08 '25 09:11 suneox

@suneox Thx for the review. I will check it again today. Maybe we also need support from BE as well

lorretheboy avatar Nov 09 '25 11:11 lorretheboy

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Nov 13 '25 16:11 melvin-bot[bot]

We're still looking proposal on this one

suneox avatar Nov 13 '25 18:11 suneox

@suneox @RachCHopkins this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Nov 18 '25 22:11 melvin-bot[bot]

Save above

suneox avatar Nov 20 '25 15:11 suneox

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Nov 20 '25 16:11 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Nov 27 '25 16:11 melvin-bot[bot]

@suneox 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Nov 28 '25 00:11 melvin-bot[bot]

Same above

suneox avatar Nov 30 '25 16:11 suneox

@deetergp @rushatgabhane - broadly, can you confirm expected behaviour of the implementation when setting a vacation delegate? Were they supposed to get access to the parent workspace chat or not?

trjExpensify avatar Dec 01 '25 18:12 trjExpensify

@suneox @RachCHopkins this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Dec 02 '25 22:12 melvin-bot[bot]

@suneox Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 04 '25 00:12 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 04 '25 16:12 melvin-bot[bot]

@trjExpensify I am not 100% sure what the expected behavior was WRT to linking to the workspace was, I'm pretty sure that whatever a vacation delegate sees on an expense before it is split, is the same thing the should see on both/either of the expenses after the initial expense is split. Does that sound right to you @rushatgabhane?

deetergp avatar Dec 05 '25 20:12 deetergp

@suneox Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Dec 05 '25 23:12 melvin-bot[bot]

@suneox 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

melvin-bot[bot] avatar Dec 09 '25 23:12 melvin-bot[bot]

Yeah, I meant putting the split bit aside. There's basically two paths in the pattern we're using elsewhere:

They don't have access to the parent chat.

  • The subtitle should show, but the "From" portion that is usually hyperlinked is not hyperlinked as they don't have access to the parent chat.

They have access to the parent chat.

  • The subtitle should show, and the "From" portion is hyperlinked to the parent chat.

To decide which one is expected, it would be good to know if a vacation delegate on being set is supposed to get an invite to the workspace chats that the delegate is a member of as an approver or not. I can see it both ways, it's not strictly necessary if we share the report with the delegate on submission to them.

trjExpensify avatar Dec 10 '25 01:12 trjExpensify

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 11 '25 16:12 melvin-bot[bot]

@suneox 10 days overdue. I'm getting more depressed than Marvin.

melvin-bot[bot] avatar Dec 11 '25 23:12 melvin-bot[bot]

Issue not reproducible during KI retests. (First week)

mvtglobally avatar Dec 13 '25 03:12 mvtglobally

To decide which one is expected, it would be good to know if a vacation delegate on being set is supposed to get an invite to the workspace chats that the delegate is a member of as an approver or not. I can see it both ways, it's not strictly necessary if we share the report with the delegate on submission to them.

I had to go look it back up in the design doc, but based on one of the bullets in the Solution Summary section it looks like we intend on inviting the delegate to the chat:

  • Invite the Vacation Delegate to the approval chat of the person who is on leave

deetergp avatar Dec 15 '25 23:12 deetergp

Okay yes, and I can see that in the pre-design. CC: @JmillsExpensify @puneetlath

Yeah agree with Puneet. The vacation delegate should be added to the vacationing employee’s workspace chat.

Then just like other approvers, we would remove that user from the workspace chat when the vacationing employee returns. At that point, the delegate would receive a system message in their own personal workspace chat.

trjExpensify avatar Dec 16 '25 16:12 trjExpensify

This issue has not been updated in over 14 days. @suneox, @RachCHopkins eroding to Weekly issue.

melvin-bot[bot] avatar Dec 16 '25 23:12 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 18 '25 16:12 melvin-bot[bot]