Skip to content

[PAID] [$1000] New Room - App crashes if create room offline and change Welcome message #19688

Closed

Description

@kbecciv

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


Issue found when executing PR #18662

Action Performed:

  1. Login to NewDot
  2. Go offline
  3. Create a public room
  4. Go to room settings and try to change Welcome message

Expected Result:

Welcome message can be changed

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.19.2

Reproducible in staging?: Yes

Reproducible in production?: No

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

Notes/Photos/Videos: Any additional supporting documentation

https://platform.applause.com/services/links/v1/external/59527d73ce682e3813444e740078eb12b099af3a21b38e501290ee2a70d0da93

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fc39914f0ea0ccf3
  • Upwork Job ID: 1663259031809458176
  • Last Price Increase: 2023-05-29

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 26, 2023
  2. melvin-bot commented on May 26, 2023

    @melvin-bot

    Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. melvin-bot commented on May 26, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. dukenv0307 commented on May 29, 2023

    @dukenv0307
    Contributor

    Proposal

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

    New Room - App crashes if create room offline and change Welcome message

    What is the root cause of that problem?

    When creating new room offline, there is no welcomeMessage field in created report on ONYX

    const [welcomeMessage, setWelcomeMessage] = useState(parser.htmlToMarkdown(props.report.welcomeMessage));

    So props.report.welcomeMessage will be undefined.
    It caused a crash app because parser.htmlToMarkdown function receive a string param

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

    We should use lodash get to get welcomeMessage like this

        const [welcomeMessage, setWelcomeMessage] = useState(parser.htmlToMarkdown(lodashGet(props.report, ['welcomeMessage'], '')));
    
    

    What alternative solutions did you explore? (Optional)

  5. hungvu193 commented on May 29, 2023

    @hungvu193
    Contributor

    Proposal

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

    New Room - App crashes if create room offline and change Welcome message

    What is the root cause of that problem?

    While creating the public room in offline mode, we save the optimistic data to the Onyx first, but our optimistic data didn't include the welcomeMessage, so after that you went to Setting => Welcome Message Page, app will crashed because of this line:

    const [welcomeMessage, setWelcomeMessage] = useState(parser.htmlToMarkdown(props.report.welcomeMessage));

    Because htmlToMarkdown function expected a string as param:

        htmlToMarkdown(htmlString) {
            let generatedMarkdown = htmlString;
            const body = /<(body)(?:"[^"]*"|'[^']*'|[^'"><])*>(?:\n|\r\n)?([\s\S]*?)(?:\n|\r\n)?<\/\1>(?![^<]*(<\/pre>|<\/code>))/im;
            const parseBodyTag = generatedMarkdown.match(body);
    
            // If body tag is found then use the content of body rather than the whole HTML
            if (parseBodyTag) {
                generatedMarkdown = parseBodyTag[2];
            }

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

    Since we added initial value for other params while creating a report, that will be better if we could also add a initialValue for welcomeMessage. We should update function buildOptimisticChatReport to include the welcomeMessage with a initial value.

    function buildOptimisticChatReport(
        participantList,
        reportName = CONST.REPORT.DEFAULT_REPORT_NAME,
        chatType = '',
        policyID = CONST.POLICY.OWNER_EMAIL_FAKE,
        ownerEmail = CONST.REPORT.OWNER_EMAIL_FAKE,
        isOwnPolicyExpenseChat = false,
        oldPolicyName = '',
        visibility = undefined,
        notificationPreference = CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS,
        parentReportActionID = '',
        parentReportID = '',
        welcomeMessage = '',
    ) {
    return {
    ....,
    welcomeMessage
    }

    In case we only want add welcomeMessage for specific report (like policyRoom), we can add more condition in the return to do that.

    What alternative solutions did you explore? (Optional)

    N/A

    Result

    Screen.Recording.2023-05-29.at.18.35.07.mov
  6. self-assigned this
    on May 29, 2023
  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 29, 2023
  8. changed the title [-]New Room - App crashes if create room offline and change Welcome message[/-] [+][$1000] New Room - App crashes if create room offline and change Welcome message[/+] on May 29, 2023
  9. melvin-bot commented on May 29, 2023

    @melvin-bot
  10. melvin-bot commented on May 29, 2023

    @melvin-bot

    Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

  11. 34 remaining items

  12. changed the title [-][HOLD for payment 2023-06-05] [$1000] New Room - App crashes if create room offline and change Welcome message[/-] [+][HOLD for payment 2023-06-07] [HOLD for payment 2023-06-05] [$1000] New Room - App crashes if create room offline and change Welcome message[/+] on May 31, 2023
  13. melvin-bot commented on May 31, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.20-5 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 2023-06-07. 🎊

    After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

    • External issue reporter - Internal report, no reporting payment necessary.
    • Contributor that fixed the issue - @hungvu193 - $1000 + $500 (speed bonus) = $1500
    • Contributor+ that helped on the issue and/or PR - @aimane-chnaif - $1000 + $500 (speed bonus) = $1500

    Speed bonus analysis: Special circumstances here so I had a quick chat with @luacmartins and we've agreed that the speed bonus should apply so I'll add that into the payment.

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  14. melvin-bot commented on May 31, 2023

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    This bug was introduced while implementing new feature.
    As offline test is already in PR checklist, this bug should have been caught earlier during PR review.
    No need further regression test step.

  15. changed the title [-][HOLD for payment 2023-06-07] [HOLD for payment 2023-06-05] [$1000] New Room - App crashes if create room offline and change Welcome message[/-] [+][HOLD for payment 2023-06-07] [$1000] New Room - App crashes if create room offline and change Welcome message[/+] on Jun 5, 2023
  16. strepanier03 commented on Jun 5, 2023

    @strepanier03
    Contributor

    @hungvu193 - I've hired you to the Upwork job so we can be ready when this comes off hold.

    @aimane-chnaif - I've also hired you for the job and will follow along for your checklist answers so I can take any needed regression test steps.

    Thank you both!

  17. hungvu193 commented on Jun 6, 2023

    @hungvu193
    Contributor

    Thanks @strepanier03 , I accepted the offer.

  18. strepanier03 commented on Jun 7, 2023

    @strepanier03
    Contributor

    @hungvu193 - I have paid you via Upwork and closed the contract, thank you!

  19. hungvu193 commented on Jun 8, 2023

    @hungvu193
    Contributor

    Thank you @strepanier03

  20. aimane-chnaif commented on Jun 8, 2023

    @aimane-chnaif
    Contributor
    • The PR that introduced the bug has been identified. Link to the PR: Add Welcome message functionality in room settings #18662
    • 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: https://github.com/Expensify/App/pull/18662/files#r1222396155
    • A discussion in #expensify-bugs 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: N/A
    • Determine if we should create a regression test for this bug.
    • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    This bug was introduced while implementing new feature.
    As offline test is already in PR checklist, this bug should have been caught earlier during PR review.
    No need further regression test step.

  21. strepanier03 commented on Jun 8, 2023

    @strepanier03
    Contributor

    Thank you @aimane-chnaif - I'll update now and finish paying the contract.

  22. changed the title [-][HOLD for payment 2023-06-07] [$1000] New Room - App crashes if create room offline and change Welcome message[/-] [+][PAID] [$1000] New Room - App crashes if create room offline and change Welcome message[/+] on Jun 8, 2023
  23. strepanier03 commented on Jun 8, 2023

    @strepanier03
    Contributor

    I've paid the contracts, ended them and left feedback.

    Thank you for the time and effort you all put in to fix this!

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.DailyKSv2EngineeringExternalAdded 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