App icon indicating copy to clipboard operation
App copied to clipboard

[$500] Private notes - Hmm its not here page displayed when clicking on thumbnail

Open lanitochka17 opened this issue 1 year ago • 28 comments

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


Version Number: 1.4.56-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: N/A Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause - Internal Team

Issue found when executing PR https://github.com/Expensify/App/pull/37566

Action Performed:

  1. Navigate to any report
  2. Click on header > Private notes
  3. Add markdown image to private notes: holla off
  4. Click on 'Private notes'
  5. Click on the image

Expected Result:

  • Image should be opened in the carousel
  • Or, image shouldn’t be rendered in private notes

Actual Result:

  • Hmm its not here page is displayed.
  • And markdown images are rendered in Private notes

Workaround:

Unknown

Platforms:

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

  • [ ] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/babb6b39-c2f7-4739-a88c-dd90e35844e2

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c6ef0c33505c63ef
  • Upwork Job ID: 1771446597185703936
  • Last Price Increase: 2024-03-23
  • Automatic offers:
    • shubham1206agra | Reviewer | 0

lanitochka17 avatar Mar 22 '24 20:03 lanitochka17

:wave: 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.

github-actions[bot] avatar Mar 22 '24 20:03 github-actions[bot]

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

melvin-bot[bot] avatar Mar 22 '24 20:03 melvin-bot[bot]

@chiragsalian FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

lanitochka17 avatar Mar 22 '24 20:03 lanitochka17

Don't think this is blocker since markdown image is new feature and still WIP of polish

cc: @kidroca

situchan avatar Mar 22 '24 20:03 situchan

Yup, I agree too. This does not feel blocker-worthy since it's a new feature. A simple resolution would be to revert the feature here - https://github.com/Expensify/App/pull/37566 but I would prefer if move forward and tidy up this bug.

chiragsalian avatar Mar 22 '24 21:03 chiragsalian

edge case that I wouldn't consider much of a blocker, but what I would recommend is that it opens an attachment carousel that only includes attachments in the private notes message.

roryabraham avatar Mar 23 '24 00:03 roryabraham

in my opinion the value of inline images way outweighs the downside of this bug, so I wouldn't want to see us revert that because of this

roryabraham avatar Mar 23 '24 00:03 roryabraham

Proposal

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

  • Private notes - Hmm its not here page displayed when clicking on thumbnail

What is the root cause of that problem?

  • We use ImageRenderer to display image
  • When clicking on an image to open the attachment modal, onPress is called, it works well with report attachments. But in case of private note, the not here page is displayed because we do not have route for this attachment

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

  • We need to create a new attachment page to display image for other images that do not belong to report.
  1. Create a CommonAttachments page:
function CommonAttachments({route}: ReportAttachmentsProps) {
    const source = Number(route.params.source) || route.params.source;
    const imageSource = tryResolveUrlFromApiRoot(source);
    return (
        <AttachmentModal
            allowDownload
            defaultOpen
            originalFileName='test-image.jpg'
            source={imageSource}
            onModalClose={() => {
                Navigation.goBack();
            }}
        />
    );
}
  1. In here, add:
    ATTACHMENTS: 'attachments',
  1. In here, add:
    ATTACHMENTS: {
        route: '/attachment',
        getRoute: (source: string) => `attachment?source=${encodeURIComponent(source)}` as const
    }
  1. In here, add:
                 <RootStack.Screen
                    name={SCREENS.ATTACHMENTS}
                    options={{
                        headerShown: false,
                        presentation: 'transparentModal',
                    }}
                    getComponent={loadCommonAttachments}
                    listeners={modalScreenListeners}
                />
  1. In here, add:
        [SCREENS.ATTACHMENTS]: ROUTES.ATTACHMENTS.route,
  1. Update this to:
                    onPress={() => {
                       if(report?.reportID){
                        const route = ROUTES.REPORT_ATTACHMENTS.getRoute(report?.reportID ?? '', source);
                        Navigation.navigate(route);
                       }
                       else {
                        const route = ROUTES.ATTACHMENTS.getRoute(source)
                        Navigation.navigate(route)
                       }
                    }}

What alternative solutions did you explore? (Optional)

  • NA

Result

https://github.com/Expensify/App/assets/161821005/cafc5bf4-ee35-4fb8-9d76-135581dabfda

nkdengineer avatar Mar 23 '24 05:03 nkdengineer

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

melvin-bot[bot] avatar Mar 23 '24 07:03 melvin-bot[bot]

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

melvin-bot[bot] avatar Mar 23 '24 07:03 melvin-bot[bot]

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

melvin-bot[bot] avatar Mar 23 '24 07:03 melvin-bot[bot]

📣 @shubham1206agra 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] avatar Mar 23 '24 07:03 melvin-bot[bot]

📣 @nkdengineer You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖

melvin-bot[bot] avatar Mar 23 '24 07:03 melvin-bot[bot]

Switching to daily as not deemed a blocker

MitchExpensify avatar Mar 25 '24 01:03 MitchExpensify

When viewing attachments in a chat, we can easily navigate between them through the attachment modal. However, for notes with multiple images, it seems we have to close and reopen the modal for each image. The presence of both attachments and chat-attachments could lead to confusion. A generic component like the ImageRenderer would require additional logic to differentiate between them, increasing the dependency on specific details. Wouldn't it be more efficient to consolidate them into a single route, either attachments or chat-attachments, and use parameters (source, reportID, noteID) to:

  • Display a single image if only source is provided.
  • Show report attachments and begin from the source when reportID is available.
  • Display note attachments if noteID is specified.

This approach could simplify the process and reduce complexity.

kidroca avatar Mar 25 '24 11:03 kidroca

@chiragsalian What do you think about this comment?

nkdengineer avatar Mar 25 '24 16:03 nkdengineer

I agree with @kidroca - it sounds like a good way to DRY things up and simplify.

roryabraham avatar Mar 25 '24 17:03 roryabraham

Just catching up here too and I like @kidroca's suggestion as well.

chiragsalian avatar Mar 25 '24 17:03 chiragsalian

What I am concerned is that, with other inputs such as task title, task description, ... we can also use image markdown. So what does the route look like?

nkdengineer avatar Mar 25 '24 17:03 nkdengineer

I am unsure who if anyone uses private notes especially for images which is causing me pause with regards to which wave or VIP this fits under. This seems super low priority to me - Maybe we should we close, what do you think @chiragsalian ?

MitchExpensify avatar Mar 26 '24 16:03 MitchExpensify

I think its VIP-vsb right, same as the issue that created this bug - this one. Even if its rare since our product support inline images i feel like we should solve this bug. Because now a user can add an image to notes and if we don't fix this then whenever they click on the image they'll get an error screen. I feel like we should solve this.

I feel like we should build a solution to support clicking markdown images besides for just notes. Like maybe even for an expense description and other spots if needed.

We could discuss in #product if we would prefer to disable clicking images or image markdown anywhere besides on chats. But if we have them then i think allowing them to be clickable might be the better user experience.

chiragsalian avatar Mar 26 '24 18:03 chiragsalian

@chiragsalian With this suggestion, what will the route look like? Currently, the report attachment has route: r/:reportID/attachment?source={source}

nkdengineer avatar Mar 26 '24 19:03 nkdengineer

From kidroca suggestion i think the idea is to modify REPORT_ATTACHMENTS (code) into something more generic like ATTACHMENTS.

As for how the route will look. I'm unsure, maybe something like this,

ATTACHMENTS: {
    route: 'a/:ID/attachment',
    getRoute: (ID: string, source: string, sourceURL: string) => `r/${ID}/attachment?source=${source}&sourceURL=${encodeURIComponent(sourceURL)}` as const,
},

ID could be reportID, noteID, reportActionID (for expense description) source could be 'report', 'note', 'reportActionID' etc so that the attachment component would know what logic to fall into. sourceURL is the image URL

@kidroca, since you are more aware of this can you double-check and lend us your thoughts.

chiragsalian avatar Mar 26 '24 20:03 chiragsalian

I think its VIP-vsb right, same as the issue that created this bug - https://github.com/Expensify/App/issues/37246.

Good shout! Thanks for the buddy check

MitchExpensify avatar Mar 27 '24 04:03 MitchExpensify

We could discuss in #product if we would prefer to disable clicking images or image markdown anywhere besides on chats. But if we have them then i think allowing them to be clickable might be the better user experience.

That sounds like a great next step to me! Are you planning to post or should I grab?

MitchExpensify avatar Mar 27 '24 04:03 MitchExpensify

Can you post and ask @MitchExpensify

chiragsalian avatar Mar 27 '24 19:03 chiragsalian

I am still waiting for final decision before creating PR

nkdengineer avatar Mar 28 '24 14:03 nkdengineer

Brought to Slack here, will report back https://expensify.slack.com/archives/C066HJM2CAZ/p1711833001511819

MitchExpensify avatar Mar 30 '24 21:03 MitchExpensify

Would expense comments with markdown images break exports @chiragsalian ?

MitchExpensify avatar Apr 01 '24 21:04 MitchExpensify