Skip to content

[$500] Workspace - The default room opening after creating a workspace is #announce #35771

Closed

Description

@lanitochka17

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: 1.4.36.0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4278685&group_by=cases:section_id&group_id=229065&group_order=asc
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to staging.chat.expensify.com
  2. Click on the "Choose a workspace" button and click on the + button next to "Workspaces" to create a new one
  3. Navigate to "Chats" by using the bottom nav

Expected Result:

It should be #admins

Actual Result:

The default room opening after creating a workspace is #announce

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6366317_1706995675650.bandicam_2024-02-02_18-15-30-499.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010c52a7ad4ac358f7
  • Upwork Job ID: 1754503277690073088
  • Last Price Increase: 2024-02-05

Activity

  1. added
    DeployBlockerCash
    on Feb 4, 2024
  2. github-actions commented on Feb 4, 2024

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  3. melvin-bot commented on Feb 4, 2024

    @melvin-bot

    Triggered auto assignment to @srikarparsi (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. lanitochka17 commented on Feb 4, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave6
    CC @greg-schroeder

  5. dukenv0307 commented on Feb 5, 2024

    @dukenv0307
    Contributor

    Proposal

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

    The default room opening after creating a workspace is #announce

    What is the root cause of that problem?

    1. We only find the admin room if openOnAdminRoom is true

    App/src/libs/ReportUtils.ts

    Lines 1025 to 1026 in 0ae07be

    if (openOnAdminRoom) {
    adminReport = sortedReports.find((report) => {

    1. We don't update isFirstTimeNewExpensifyUser in Onyx to true when we show engagement modal

    isFirstTimeNewExpensifyUser = false;

    isFirstTimeNewExpensifyUser = false;

    And then we return the first report in the sorted report list by lastRead that is not concierge chat

    return adminReport ?? sortedReports.find((report) => !isConciergeChatReport(report)) ?? null;

    1. When we create optimistic data for new workspace, announce report is created first so the first report in the sorted report list is the announce report.

    const announceCreatedAction = buildOptimisticCreatedReportAction(CONST.POLICY.OWNER_EMAIL_FAKE);

    That is the root cause of this issue

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

    1. We should update isFirstTimeNewExpensifyUser in Onyx to true instead of setting isFirstTimeNewExpensifyUser variable to false

    isFirstTimeNewExpensifyUser = false;

    isFirstTimeNewExpensifyUser = false;

    1. When we create optimistic data for new workspace, we should config the lastReadTime of announce, admin, and policyExpense report to make the last read time of admin room is biggest

    const announceCreatedAction = buildOptimisticCreatedReportAction(CONST.POLICY.OWNER_EMAIL_FAKE);

    What alternative solutions did you explore? (Optional)

    We can always get adminReport in findLastAccessedReport and only not report it if it doesn't exist.

  6. added
    Daily
    and removed
    DeployBlockerCash
    Hourly
    on Feb 5, 2024
  7. moved this to Release 1: Ideal Nav & Collect Simplfied Profile, Members, Categories, Workflows (approvals) in [#whatsnext] Wave 08 - Collect Plan Adminson Feb 5, 2024
  8. added
    External
    on Feb 5, 2024
  9. changed the title [-]Workspace - The default room opening after creating a workspace is #announce[/-] [+][$500] Workspace - The default room opening after creating a workspace is #announce[/+] on Feb 5, 2024
  10. melvin-bot commented on Feb 5, 2024

    @melvin-bot
  11. added
    Help Wanted
    on Feb 5, 2024
  12. melvin-bot commented on Feb 5, 2024

    @melvin-bot

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

  13. mountiny commented on Feb 5, 2024

    @mountiny
    Contributor
  14. mountiny commented on Feb 5, 2024

    @mountiny
    Contributor

    I can take this over since its related to ideal nav

  15. removed
    Help Wanted
    on Feb 5, 2024
  16. Tony-MK commented on Feb 6, 2024

    @Tony-MK
    Contributor

    Proposal

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

    What is the root cause of that problem?

    The sortReportsByLastRead function is used to get the last read report for ReportScreenIDSetter to set a report ID.

    let sortedReports = sortReportsByLastRead(reportsValues, reportMetadata);

    However, the value of lastReadTime in optimistic adminsChat and announceChat are equal hence, the ReportUtils.findLastAccessedReport function will return the announceChatReportID for the ReportScreenIDSetter.

    lastReadTime: currentTime,

    App/src/libs/ReportUtils.ts

    Lines 904 to 916 in b7a3fca

    /**
    * Given an array of reports, return them sorted by the last read timestamp.
    */
    function sortReportsByLastRead(reports: Report[], reportMetadata: OnyxCollection<ReportMetadata>): Array<OnyxEntry<Report>> {
    return reports
    .filter((report) => !!report?.reportID && !!(reportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`]?.lastVisitTime ?? report?.lastReadTime))
    .sort((a, b) => {
    const aTime = new Date(reportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${a?.reportID}`]?.lastVisitTime ?? a?.lastReadTime ?? '');
    const bTime = new Date(reportMetadata?.[`${ONYXKEYS.COLLECTION.REPORT_METADATA}${b?.reportID}`]?.lastVisitTime ?? b?.lastReadTime ?? '');
    return aTime.valueOf() - bTime.valueOf();
    });
    }

    Furthermore, I noticed, in the backend response, that the value of lastReadTime of the announceChat is greater than that of adminsChat and is a contributing factor to the issue due to the nature of the sortReportsByLastRead function.

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

    At the backend, we should create the admin chat before the announce chat. H
    ence, the response must return the value of adminsChatData.lastReadTime to be greater than announceChatData.lastReadTime.

    For the offline fixes, we should set adminsChatData.lastReadTime a couple of milliseconds from the rest of the chats by using a function such as DateUtils.subtractMillisecondsFromDateTime just like the backend.

    What alternative solutions did you explore? (Optional)

    Option A:

    If the backend fix is not feasible, we could update the lastVistedTime after the Policy.createWorkspace function has finished executing in the savePolicyDraftByNewWorkspace.

    This will force the sortReportsByLastRead function to use lastVistedTime instead of lastReadTime.

    Option B:

    Apart from navigating to ROUTES.HOME, in the BottomTabBar component, we can modify the route taken by the Navigation.navigate function to the policy's admin chat.

    Only if it is a newly created policy.

    <Tooltip text={translate('common.chats')}>
    <PressableWithFeedback
    onPress={() => {
    Navigation.navigate(ROUTES.HOME);
    }}
    role={CONST.ROLE.BUTTON}

  17. mountiny commented on Feb 6, 2024

    @mountiny
    Contributor

    We are going to do nothing in this case, there will be update to this flow coming in future to changes here would be wasted time

  18. moved this from Release 1: Ideal Nav & Collect Simplfied Profile, Members, Categories, Workflows (approvals) to Done in [#whatsnext] Wave 08 - Collect Plan Adminson Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

DailyEngineeringExternal

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions