Skip to content

[HOLD for payment 2023-09-29] [$1000] Android - Login - Linkified email from external app is pasted as linkified email in email field #21411

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!


Action Performed:

  1. Copy a linkified email address from external app (like gmail).
  2. Launch New Expensify app.
  3. Long tap on the email field.
  4. Select Paste.

Expected Result:

Email is not linkified

Actual Result:

Email is linkified

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

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6103773_Screen_Recording_20230623_181250_New_Expensify.mp4

Bug6103773_Screenshot_20230623_155332

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fec00bf5a9d050cf
  • Upwork Job ID: 1673491584987435008
  • Last Price Increase: 2023-06-27

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on Jun 23, 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. jakub-trzebiatowski commented on Jun 23, 2023

    @jakub-trzebiatowski
    Contributor

    Proposal

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

    When pasting rich text to the e-mail field, the formatting is preserved, although we'd like the text to be plain text.

    What is the root cause of that problem?

    On Android, TextInput for some reason is rich text input by default. It can contain initial formatted text, for example:

    <TextInput>
        Hello, <Text style={{color:'red'}}>World</Text>
    </TextInput>

    Also, formatted text can be pasted by the user.

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

    Surprisingly, there is no way to disable the rich text properties of the TextInput.

    There is a workaround, though. One can heuristically detect when the text is pasted and change it to some other text (so the internal formatting markers are cleared), but immediately change it back.

    We could introduce these helpers:

    const zeroWidthSpace = '\u8203';
    
    /**
     * A very simple heuristic for detecting whether the text was pasted
     *
     * @param {String} oldText
     * @param {String} newText
     * @return {Boolean}
     */
    function isTextPasted(oldText, newText) {
        return Math.abs(newText.length - oldText.length) > 1;
    }
    
    /**
     * A helper for setting a TextInput-managed state, which ensures that the
     * text keeps being plain, even when formatted text is pasted by the user.
     *
     * @param {Object} component
     * @param {Function} buildState
     * @param {String} oldText
     * @param {String} newText
     */
    function setPlainTextInputState(component, buildState, oldText, newText) {
        if (isTextPasted(oldText, newText)) {
            // Set a similar but different text, so TextInput clears formatting markers
            component.setState(buildState(
                `${zeroWidthSpace}${newText}${zeroWidthSpace}`,
            ), () => {
                // Change back to the pasted text (in the plain text)
                component.setState(buildState(newText));
            });
        } else {
            // If it doesn't look like a paste, set the state directly to minimize flickering
            component.setState(buildState(newText));
        }
    }

    And then use them in LoginForm's onTextInput method:

        /**
         * Handle text input and clear formError upon text change
         *
         * @param {String} newText
         */
        onTextInput(newText) {
            setPlainTextInputState(
                this,
                (text) => ({login: text}),
                this.state.login,
                newText,
            );
    
            this.setState({
                formError: null,
            });
    
            // ...
        }
  5. Christinadobrzyn commented on Jun 23, 2023

    @Christinadobrzyn
    Contributor

    I'm not able to replicate this - reaching out in Slack to get more specific directions on how the email is copied.

  6. jakub-trzebiatowski commented on Jun 24, 2023

    @jakub-trzebiatowski
    Contributor

    @Christinadobrzyn

    You can copy any link, for what it's worth. Let's say from here. When I copied from Chrome, I had to use text selection.

    RichText-1-compressed.mp4
  7. Christinadobrzyn commented on Jun 27, 2023

    @Christinadobrzyn
    Contributor

    I might not be able to get this to work on Browserstack but it seems like enough people can reproduce it so I'll send it to External.

  8. changed the title [-] Android - Login - Linkified email from external app is pasted as linkified email in email field[/-] [+][$1000] Android - Login - Linkified email from external app is pasted as linkified email in email field[/+] on Jun 27, 2023
  9. melvin-bot commented on Jun 27, 2023

    @melvin-bot
  10. 117 remaining items

  11. melvin-bot commented on Sep 22, 2023

    @melvin-bot

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

  12. melvin-bot commented on Sep 22, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-11 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-09-29. 🎊

    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
    • Contributor that fixed the issue
    • Contributor+ that helped on the issue and/or PR

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

    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
  13. melvin-bot commented on Sep 22, 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:

    • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
    • [@s77rt] 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:
    • [@s77rt] 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:
    • [@s77rt] Determine if we should create a regression test for this bug.
    • [@s77rt] 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.
    • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  14. s77rt commented on Sep 23, 2023

    @s77rt
    Member
    • The PR that introduced the bug has been identified: N/A This was a bug in RN
    • The offending PR has been commented on: N/A
    • A discussion in #expensify-bugs has been started: N/A
    • Determine if we should create a regression test for this bug: No
  15. Christinadobrzyn commented on Sep 29, 2023

    @Christinadobrzyn
    Contributor

    Payouts due:

    Issue Reporter: NA
    Contributor: $1000 @fabriziobertoglio1987
    Contributor+: $1000 @s77rt

    Eligible for 50% #urgency bonus? N based on #21411 (comment) but also it looks like the PR was created Sept 13th & merged Sept 19th - does that sound right?

    Upwork job is here.

  16. s77rt commented on Sep 29, 2023

    @s77rt
    Member

    @Christinadobrzyn Can you please double check the Upwork job. It seems unavailable.

  17. melvin-bot commented on Oct 3, 2023

    @melvin-bot

    @s77rt, @Gonals, @fabriziobertoglio1987, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick!

  18. Christinadobrzyn commented on Oct 3, 2023

    @Christinadobrzyn
    Contributor

    Hi @s77rt the Upwork job is closed, sorry I didn't realise that meant you couldn't see it. You and @fabriziobertoglio1987 were automatically hired so I can pay you through the closed job still.

    Will you confirm the payment details here are good and I'll pay this? #21411 (comment)

  19. s77rt commented on Oct 3, 2023

    @s77rt
    Member

    @Christinadobrzyn The payout summary looks correct 👍

  20. Christinadobrzyn commented on Oct 3, 2023

    @Christinadobrzyn
    Contributor

    Perfect! Thanks for confirming @s77rt!

    I have paid both you and @fabriziobertoglio1987 based on the payment structure here

    I'll close this out but please let me know if you need anything else!

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