Skip to content

[Due for payment 2025-12-03] [$250] The send attachment modal is not closed when admin changes who can post to Admins only #73833

Closed

Description

@nlemma

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.2.41-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://github.com/Expensify/Expensify/issues/530095
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: Windows 10 - Chrome
App Component: Other

Action Performed:

  1. Launch Expensify.
  2. As User A, create a new chat room.
  3. As User A, invite user B to the chat room that was created in step 2.
  4. As User B, open the chat room and add an attachment, but do not send the attachment at the final step.
  5. As User A, change the Who can post setting for the chat room to Only admins.
  6. As User B, check the send attachment modal

Expected Result:

The send attachment modal is closed, and that the app returns to the chat room.

Actual Result:

The send attachment modal is not closed, and that the app doesn't return to the chat room

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6986561_1761634142938.2025-10-28_09_42_12.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021983922271257047610
  • Upwork Job ID: 1983922271257047610
  • Last Price Increase: 2025-11-06
Issue OwnerCurrent Issue Owner: @twisterdotcom

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 30, 2025
  2. melvin-bot commented on Oct 30, 2025

    @melvin-bot

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

  3. Nodebrute commented on Oct 30, 2025

    @Nodebrute
    Contributor

    Proposal

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

    The send attachment modal is not closed when admin changes who can post to Admins only

    What is the root cause of that problem?

    Currently we don't have any logic that closes the modal when user change the permission to admins only.

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

    We can track previous isAdminsOnlyPostingRoom state with usePrevious hook and detect the permission change(All members -> admins only) and then dismiss the modal when a non-admin loses posting permission.

    validateAttachmentFile(fileParam).then(updateState);
    }, [fileParam]);

    pseudo code

        const prevIsAdminsOnlyPostingRoom = usePrevious(isAdminsOnlyPostingRoom(report));
        const isUserPolicyAdmin = isPolicyAdmin(policy);
       useEffect(() => {
            const isCurrentlyAdminsOnlyRoom = isAdminsOnlyPostingRoom(report);
            
            // Only close if it changed from false to true (permissions were restricted)
            if (!prevIsAdminsOnlyPostingRoom && isCurrentlyAdminsOnlyRoom && !isUserPolicyAdmin) {
                Navigation.dismissModal();
            }
        }, [report, prevIsAdminsOnlyPostingRoom, isUserPolicyAdmin]);
    

    What alternative solutions did you explore? (Optional)

    Alternatively, we can check if isAdminsOnlyPostingRoom and user is not the admin then dismiss the modal

  4. twisterdotcom commented on Oct 30, 2025

    @twisterdotcom
    Contributor

    @akinwale is this correct? These testing steps don't seem to work: #64556 (comment)

  5. Krishna2323 commented on Oct 30, 2025

    @Krishna2323
    Contributor

    Proposal

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

    The send attachment modal is not closed when admin changes who can post to Admins only

    What is the root cause of that problem?

    • The ReportAddAttachmentModalContent component does not have any logic to close the modal when write permissions are changed.
    • The add-attachment view is now a dedicated route (REPORT_ADD_ATTACHMENT), not a child of the composer. When “Who can post” changes, the composer unmounts, but this route stays mounted. So BaseModal’s unmount path never runs.
    • Worked before as mentioned here but now REPORT_ADD_ATTACHMENT is a dedicated route.

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

    • Add a useEffect to watch for write permission changes and dismiss the modal when the user doesn't have required permission.
        // Close the modal if user loses write access (e.g., admin switches "Who can post" to Admins only)
        const isReportArchived = useReportIsArchived(reportID);
        const canPerformWriteAction = useMemo(() => canUserPerformWriteAction(report, isReportArchived), [report, isReportArchived]);
        useEffect(() => {
            if (canPerformWriteAction) {
                return;
            }
            Navigation.dismissModal();
        }, [canPerformWriteAction]);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

  6. akinwale commented on Oct 30, 2025

    @akinwale
    Contributor

    @akinwale is this correct? These testing steps don't seem to work: #64556 (comment)

    Yes, they should be correct. Here's the video from when I tested.

    65738-web-1.mp4
  7. Krishna2323 commented on Oct 30, 2025

    @Krishna2323
    Contributor

    PROPOSAL UPDATED

    • Update RCA
  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 30, 2025
  9. changed the title [-]The send attachment modal is not closed when admin changes who can post to Admins only[/-] [+][$250] The send attachment modal is not closed when admin changes who can post to Admins only[/+] on Oct 30, 2025
  10. melvin-bot commented on Oct 30, 2025

    @melvin-bot
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 30, 2025
  12. melvin-bot commented on Oct 30, 2025

    @melvin-bot

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

  13. 30 remaining items

  14. changed the title [-][$250] The send attachment modal is not closed when admin changes who can post to Admins only[/-] [+][Due for payment 2025-12-03] [$250] The send attachment modal is not closed when admin changes who can post to Admins only[/+] on Nov 26, 2025
  15. melvin-bot commented on Nov 26, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  16. melvin-bot commented on Nov 26, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.63-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-12-03. 🎊

    For reference, here are some details about the assignees on this issue:

    • @mananjadhav requires payment through NewDot Manual Requests
    • @Krishna2323 requires payment through NewDot Manual Requests
  17. melvin-bot commented on Nov 26, 2025

    @melvin-bot

    @mananjadhav / @Krishna2323 @twisterdotcom The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  18. mananjadhav commented on Dec 2, 2025

    @mananjadhav
    Collaborator

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: Couldn't pinpoint the offending PR.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/574189

    Regression Test Proposal

    Precondition:

    • Have 2 accounts with the app, say User A and User B.

    Test:

    1. As User A, create a new chat room.
    2. As User A, invite user B to the chat room that was created in step 1.
    3. As User B, open the chat room and add an attachment, but do not send the attachment at the final step.
    4. As User A, change the Who can post setting for the chat room to Only admins.
    5. As User B, verify the modal is closed

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-2054-a474-90cf-5e97b409b844
  19. mananjadhav commented on Dec 2, 2025

    @mananjadhav
    Collaborator

    @twisterdotcom This one is ready for payout on Dec 03

  20. twisterdotcom commented on Dec 3, 2025

    @twisterdotcom
    Contributor

    Payment Summary:

  21. Krishna2323 commented on Dec 6, 2025

    @Krishna2323
    Contributor

    Requested in ND.

  22. quinthar commented on Dec 8, 2025

    @quinthar
    Contributor

    Approved $250 to @Krishna2323

  23. quinthar commented on Dec 8, 2025

    @quinthar
    Contributor

    Approved $250 to @mananjadhav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions