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

[HOLD for payment 2023-06-21] [$1000] Thread - Crash when opening the thread image #20214

Closed
6 tasks done
lanitochka17 opened this issue Jun 5, 2023 · 33 comments
Closed
6 tasks done
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jun 5, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Login with any account
  3. Go to any chat
  4. Send an image to the user
  5. Click on "Reply in thread" after sending the image
  6. Click to preview the image

Expected Result:

Image opens

Actual Result:

App is crashed

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

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

Recording.4826.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal team and @priya-zha
Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b43bec189a9704e2
  • Upwork Job ID: 1665923449380827136
  • Last Price Increase: 2023-06-06
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

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

@strepanier03
Copy link
Contributor

Super easy to recreate. Moving on.

image

@strepanier03 strepanier03 added the External Added to denote the issue can be worked on by a contributor label Jun 6, 2023
@melvin-bot melvin-bot bot changed the title Thread - Crash when opening the thread image [$1000] Thread - Crash when opening the thread image Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01b43bec189a9704e2

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Current assignee @strepanier03 is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

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

@tienifr
Copy link
Contributor

tienifr commented Jun 6, 2023

Proposal

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

App crash when opening the thread image

What is the root cause of that problem?

In

const actions = ReportActionsUtils.getSortedReportActions(_.values(this.props.reportActions));
const attachments = [];
const htmlParser = new HtmlParser({
onopentag: (name, attribs) => {
if (name !== 'img' || !attribs.src) {
return;
}
const expensifySource = attribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE];
// By iterating actions in chronological order and prepending each attachment
// we ensure correct order of attachments even across actions with multiple attachments.
attachments.unshift({
source: tryResolveUrlFromApiRoot(expensifySource || attribs.src),
isAuthTokenRequired: Boolean(expensifySource),
file: {name: attribs[CONST.ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE] || attribs.src.split('/').pop()},
});
},
});
_.forEach(actions, (action) => htmlParser.write(_.get(action, ['message', 0, 'html'])));
htmlParser.end();

We get the reportActions from reportID.
Next, we iterate the actions to find the attachments and add them to attachments.

but in thread, we don't have the logic to get the parentReportAction, so when users click the parent image, we can't find this source => the page become -1 and throw the error

const page = _.findIndex(attachments, (a) => a.source === this.props.source);
if (page === -1) {
throw new Error('Attachment not found');
}

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

subscribe report in AttachmentCarousel or pass report from parent component to AttachmentCarousel

in createInitialState function, find the parentReportAction from report, and inject it to actions

        const parentReportAction = ReportActionsUtils.getParentReportAction(this.props.report)

Result

Screen.Recording.2023-06-06.at.11.00.54.mov

@s77rt
Copy link
Contributor

s77rt commented Jun 7, 2023

@tienifr Thanks for the proposal. Your RCA is correct and the solution looks good to me. Let's pass report instead of reportID.

🎀 👀 🎀 C+ reviewed

cc @NikkiWines

@strepanier03
Copy link
Contributor

Friendly bump @NikkiWines for your review so we can keep good pace on moving this forward 🙌

@NikkiWines
Copy link
Contributor

Sorry for the delay,! Agreed with @s77rt - let's go with @tienifr's solution 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 8, 2023

📣 @tienifr You have been assigned to this job by @NikkiWines!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 8, 2023
@tienifr
Copy link
Contributor

tienifr commented Jun 8, 2023

The PR is ready for review: #20338

@strepanier03
Copy link
Contributor

PR has been merged so we're just waiting on deploys. All good for now!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 14, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Thread - Crash when opening the thread image [HOLD for payment 2023-06-21] [$1000] Thread - Crash when opening the thread image Jun 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 15, 2023
@melvin-bot

This comment was marked as outdated.

@strepanier03
Copy link
Contributor

@zanyrenney - I'm leaving for sabbatical this evening and will not be available to pay this on the 21st. Thank you for handling it!

@melvin-bot melvin-bot bot added the Overdue label Jun 19, 2023
@zanyrenney
Copy link
Contributor

Sure thing! Awaiting payment still, not overdue.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Overdue Daily KSv2 labels Jun 19, 2023
@zanyrenney
Copy link
Contributor

Looks like the contributors weren't assigned initially, so assigning them now.

@zanyrenney
Copy link
Contributor

zanyrenney commented Jun 22, 2023

@s77rt @tienifr @priya-zha have all now been invited to this job via upwork. please accept so that we can pay this out.

@zanyrenney
Copy link
Contributor

Hey, I am heading OOO shortly, so assigning another bug0 team member to help with this issue whilst I am OOO.

All the contributors and bug reporter have been invited to the job on Upwork so only paying them out (once they accept) remains.

@zanyrenney zanyrenney removed the Bug Something is broken. Auto assigns a BugZero manager. label Jun 22, 2023
@zanyrenney zanyrenney removed their assignment Jun 22, 2023
@zanyrenney zanyrenney added the Bug Something is broken. Auto assigns a BugZero manager. label Jun 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

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

@priya-zha
Copy link

@zanyrenney submitted the proposal. Thanks.

@zanyrenney zanyrenney self-assigned this Jun 22, 2023
@s77rt
Copy link
Contributor

s77rt commented Jun 22, 2023

Applied!

@tienifr
Copy link
Contributor

tienifr commented Jun 23, 2023

@zanyrenney applied, thanks!

@tjferriss
Copy link
Contributor

I've hired everyone in Upworks. Once the offers are accepted, I'll process the payments.

@s77rt
Copy link
Contributor

s77rt commented Jun 23, 2023

Accepted!

@melvin-bot melvin-bot bot added the Overdue label Jun 26, 2023
@tjferriss
Copy link
Contributor

All payments have been sent including the speed bonus.

@melvin-bot melvin-bot bot removed the Overdue label Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants