Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having the 'hidden' notification preference" the reports are displayed in LHN and not marked as read by the migration #52396

Open
1 of 8 tasks
m-natarajan opened this issue Nov 12, 2024 · 11 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Reviewing Has a PR in review Weekly KSv2

Comments

@m-natarajan
Copy link

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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @Puneet-here
Slack conversation (hyperlinked to channel name): ts_external_expensify_migrate

Action Performed:

Precondition : Admin has preference set to "focus mode"

  1. Create a workspace
  2. Submit expense report as a employee
  3. Approve and pay the report

Expected Result:

Having the 'hidden' notification preference" the reports are not displayed in LHN and marked as read by the migration

Actual Result:

Having the 'hidden' notification preference" the reports are displayed in LHN and not marked as read by the migration

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

image (17)

{
    "chatReportID": "1137125431319052",
    "chatType": "",
    "currency": "AUD",
    "description": "",
    "errorFields": {},
    "hasOutstandingChildRequest": false,
    "hasOutstandingChildTask": false,
    "hasParentAccess": false,
    "isCancelledIOU": false,
    "isOwnPolicyExpenseChat": false,
    "isPinned": false,
    "isWaitingOnBankAccount": false,
    "lastActionType": "IOU",
    "lastActorAccountID": "8279983",
    "lastMessageHtml": "$6.84 expense",
    "lastMessageText": "$6.84 expense",
    "lastReadSequenceNumber": 0,
    "lastVisibleActionCreated": "2024-11-11 21:46:49.258",
    "lastVisibleActionLastModified": "2024-11-11 21:46:49.258",
    "managerID": 2012843,
    "nonReimbursableTotal": -1573,
    "notificationPreference": "hidden",
    "oldPolicyName": "",
    "ownerAccountID": 8279983,
    "parentReportActionID": "3224493339114563292",
    "parentReportID": "1137125431319052",
    "participants": {
        "778531": {
            "hidden": true,
            "notificationPreference": "hidden"
        },
        "2012843": {
            "hidden": true,
            "notificationPreference": "hidden"
        },
        "8279983": {
            "hidden": true,
            "notificationPreference": "hidden"
        },
        "9645353": {
            "hidden": true,
            "notificationPreference": "hidden"
        },
        "9662119": {
            "hidden": true,
            "notificationPreference": "hidden"
        },
        "9713816": {
            "hidden": true,
            "notificationPreference": "hidden"
        },
        "10903701": {
            "hidden": true,
            "notificationPreference": "hidden"
        }
    },
    "permissions": [
        "read",
        "write"
    ],
    "policyID": "0D00F2B7A62842CD",
    "private_isArchived": "",
    "reportID": "60770197",
    "reportName": "Cheryl Expenses to 2020-05-03",
    "stateNum": 2,
    "statusNum": 3,
    "total": -1573,
    "type": "expense",
    "unheldNonReimbursableTotal": -1573,
    "unheldTotal": -1573,
    "welcomeMessage": "",
    "writeCapability": "all"
}

View all open jobs on GitHub

@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Nov 12, 2024
@m-natarajan m-natarajan moved this to First Cohort - CRITICAL in [#whatxnext] #migrate Nov 12, 2024
Copy link

melvin-bot bot commented Nov 12, 2024

Triggered auto assignment to @alexpensify (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.

@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@puneetlath puneetlath removed the Needs Reproduction Reproducible steps needed label Nov 13, 2024
@puneetlath
Copy link
Contributor

@ikevin127 is going to help out with this one. Discussing here: https://expensify.slack.com/archives/C02NK2DQWUX/p1731537652304929

@ikevin127
Copy link
Contributor

@puneetlath What I found as root cause for why your report is still being shown is because in the code block below shouldOverrideHidden is true because isExpenseReportWithoutParentAccess is true which comes from your report object's hasParentAccess being false (see diff below):

const shouldOverrideHidden =
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
hasValidDraftComment(report.reportID) || hasErrorsOtherThanFailedReceipt || isFocused || isSystemChat || report.isPinned || isExpenseReportWithoutParentAccess;
if (isHidden && !shouldOverrideHidden) {
return;
}

I confirmed this using Onyx.set locally as instructed, your report object (red) vs mine (green, which doesn't show up in LHN) here's the differences:

DIFF
{
  "chatReportID": "7874291990759816",
  "chatType": "",
  "currency": "USD",
  "description": "",
  "errorFields": {},
  "hasOutstandingChildRequest": false,
  "hasOutstandingChildTask": false,
- "hasParentAccess": false,
+ "hasParentAccess": true,
  "isCancelledIOU": false,
  "isOwnPolicyExpenseChat": false,
  "isPinned": false,
  "isWaitingOnBankAccount": false,
  "lastActionType": "IOU",
  "lastActorAccountID": "17364253",
- "lastMessageHtml": "$14.82 expense",
+ "lastMessageHtml": "paid $3.00 elsewhere",
- "lastMessageText": "$14.82 expense",
+ "lastMessageText": "paid $3.00 elsewhere",
  "lastReadSequenceNumber": 0,
- "lastVisibleActionCreated": "2024-11-11 22:01:02.083",
+ "lastVisibleActionCreated": "2024-11-13 23:33:10.631",
- "lastVisibleActionLastModified": "2024-11-11 22:01:02.083",
+ "lastVisibleActionLastModified": "2024-11-13 23:33:10.631",
  "managerID": 17364253,
- "nonReimbursableTotal": -7335,
+ "nonReimbursableTotal": 0,
  "notificationPreference": "hidden",
  "oldPolicyName": "",
  "ownerAccountID": 17364253,
  "parentReportActionID": "5395595152947009671",
  "parentReportID": "7874291990759816",
  "participants": {
    "17364253": {
      "hidden": true,
      "notificationPreference": "hidden"
    },
    "8033800": {
      "hidden": true,
      "notificationPreference": "hidden"
    },
    "9645353": {
      "hidden": true,
      "notificationPreference": "hidden"
    },
    "9662119": {
      "hidden": true,
      "notificationPreference": "hidden"
    },
    "9713816": {
      "hidden": true,
      "notificationPreference": "hidden"
    },
    "10903701": {
      "hidden": true,
      "notificationPreference": "hidden"
    }
  },
- "permissions": ["read", "write"],
+ "permissions": [],
  "policyID": "3B4762A4CCFD7388",
  "private_isArchived": "",
  "reportID": "3492368652977899",
- "reportName": "[Expensify Canada Inc] Justin's Expenses 2023-08-09 #R000V1AkK1m3",
+ "reportName": "Expense Report #3492368652977899",
- "statusNum": 3,
+ "statusNum": 4,
- "total": -7335,
+ "total": -300,
  "type": "expense",
- "unheldNonReimbursableTotal": -7335,
+ "unheldNonReimbursableTotal": 0,
- "unheldTotal": -7335,
+ "unheldTotal": -300,
  "welcomeMessage": "",
  "writeCapability": "all",
+ "lastReadTime": "2024-11-14 00:10:55.482"
}

When it comes to a solution, I don't have the context behind hasParentAccess and all its implications therefore I cannot be certain of the way to go here - but since we have the shouldOverrideHidden logic which includes the isExpenseReportWithoutParentAccess check, I'm assuming there must be a reason for it.

@puneetlath
Copy link
Contributor

Got it! I had a feeling it might be something to do with that.

That logic should only show the report in the LHN if the report has an RBR or GBR. Otherwise, it should remain hidden. Can you adjust it accordingly?

@ikevin127
Copy link
Contributor

@puneetlath You're saying that from this check:

const shouldOverrideHidden =
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
hasValidDraftComment(report.reportID) || hasErrorsOtherThanFailedReceipt || isFocused || isSystemChat || report.isPinned || isExpenseReportWithoutParentAccess;

  1. We should only remove isExpenseReportWithoutParentAccess and keep all other checks ?
  2. If yes to (1.), should I open a PR with the change ?
  3. If yes to (2.), given that I don't have access to your Expensify account for testing, for the Screenshots/Videos section of the PR Author Checklist should I demonstrate the fix using Onyx.set locally ?

@puneetlath
Copy link
Contributor

For 1, if we remove it from there will the expense report still show up in the LHN if it has a RBR/GBR? Because we do want it to show up in that scenario.

@puneetlath
Copy link
Contributor

If yes, then I'd say yes to both 2 and 3.

@ikevin127
Copy link
Contributor

For 1, if we remove it from there will the expense report still show up in the LHN if it has a RBR/GBR? Because we do want it to show up in that scenario.

@puneetlath Yes, expenses with RBR/GBR and other specific cases will still show up because all the other check conditions that are part of shouldOverrideHidden.

Before moing on with opening a PR, I did some digging into when isExpenseReportWithoutParentAccess was added to the condition and it was in commit 7db6f63 coming from PR #49557 where Details section says:

This is a follow-up to #48661, where I'm realizing we don't even care if the user is the report manager -> If the user doesn't have access to the expense report's parent report, we want to show this report in the LHN so the user always has access somehow

The part I put in bold is the key here because if I remove isExpenseReportWithoutParentAccess from the condition then we will revert that behaviour. Therefore, before moving forward I want to confirm with you whether we still care about that part that is is bold above (from the other PR) or we care more about this issue to have the reports hidden.

Please let me know!

@puneetlath
Copy link
Contributor

Thanks for double checking. Yes that's correct. We only care to show them if they have an RBR or GBR.

@ikevin127
Copy link
Contributor

ikevin127 commented Nov 14, 2024

Understood, will have a PR open in a few hours about 1 hour.

Edit: ✅ PR #52533 is open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Reviewing Has a PR in review Weekly KSv2
Projects
Status: First Cohort - CRITICAL
Development

No branches or pull requests

5 participants