App icon indicating copy to clipboard operation
App copied to clipboard

[$750] Chat - When opening a chat with lots of unread messages user needs to scroll up to find last read message

Open kbecciv opened this issue 1 year ago β€’ 23 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.28.0 Reproducible in staging?: y Reproducible in production?: y 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 Expensify/Expensify Issue URL: Issue reported by: @MonilBhavsar Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1705558628672569

Action Performed:

  1. A is participant of a chat or room
  2. As another user send some good number of messages to chat report, so new messages can be scrolled up and down
  3. As user A, open the chat report

Expected Result:

The chat report view opens from where the messages are unread and user can scroll down

Actual Result:

The chat report view is scrolled down to the last message and user needs to scroll up to find last read message

Workaround:

Unknown

Platforms:

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

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/93399543/55def247-9ffe-439d-8f24-12aa35aee272

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fc144b2f2f5df388
  • Upwork Job ID: 1749920553887232000
  • Last Price Increase: 2024-04-27

kbecciv avatar Jan 23 '24 22:01 kbecciv

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

melvin-bot[bot] avatar Jan 23 '24 22:01 melvin-bot[bot]

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

melvin-bot[bot] avatar Jan 23 '24 22:01 melvin-bot[bot]

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

melvin-bot[bot] avatar Jan 23 '24 22:01 melvin-bot[bot]

This PR https://github.com/Expensify/App/pull/28793 specifically makes it scrolled to the bottom, seems like NAB

jeremy-croff avatar Jan 24 '24 04:01 jeremy-croff

I'm a bit confused by the bug report @MonilBhavsar, so asking about it here. I thought this was something we'd implement via comment linking.

trjExpensify avatar Jan 24 '24 13:01 trjExpensify

HOLD for comment linking: https://github.com/Expensify/App/pull/30269

roryabraham avatar Jan 24 '24 19:01 roryabraham

Current assignee @trjExpensify is eligible for the NewFeature assigner, not assigning anyone new.

melvin-bot[bot] avatar Jan 24 '24 19:01 melvin-bot[bot]

No change, still on hold Melv!

trjExpensify avatar Feb 05 '24 13:02 trjExpensify

Samesies, Melv!

trjExpensify avatar Feb 14 '24 22:02 trjExpensify

Still on hold, comment linking got held for the deploy freeze last week.

trjExpensify avatar Feb 26 '24 12:02 trjExpensify

PR still not merged.

trjExpensify avatar Mar 07 '24 11:03 trjExpensify

Comment linking PR still in the works.

trjExpensify avatar Mar 18 '24 10:03 trjExpensify

@roryabraham, you okay with now taking this off hold?

trjExpensify avatar Apr 02 '24 13:04 trjExpensify

Bumped!

trjExpensify avatar Apr 12 '24 18:04 trjExpensify

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Apr 13 '24 16:04 melvin-bot[bot]

Looking for proposals. @jeremy-croff not sure if you're interested?

trjExpensify avatar Apr 16 '24 00:04 trjExpensify

@trjExpensify, @mollfpr Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Apr 19 '24 18:04 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Apr 20 '24 16:04 melvin-bot[bot]

Still looking for proposals!

trjExpensify avatar Apr 23 '24 01:04 trjExpensify

@trjExpensify, @mollfpr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Apr 26 '24 18:04 melvin-bot[bot]

Upwork job price has been updated to $750

melvin-bot[bot] avatar Apr 27 '24 12:04 melvin-bot[bot]

Bumped the price up to $750

trjExpensify avatar Apr 27 '24 12:04 trjExpensify

Proposal

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

When opening a chat with lots of unread messages, the user needs to scroll up to find last read message.

What is the root cause of that problem?

New Feature - The logic is missing / non-existent.

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

We need a new useEffect within the ReportActionsList component which will scrollToFirstUnreadMessage when we open the report.

To do this we will need to modify our existing reportScrollManager.scrollToIndex function to optionally take in the viewPosition argument because we're inverting the flatlist which means that we would need to pass viewPosition: 1 to the FlatList's scrollToIndex function such that we are scrolling to the top of the new message (unread marker).

New useEffect code
    useEffect(() => {
        // Logic to scroll to the first unread message, if there is one and it's not in view.
        const scrollToFirstUnreadMessage = () => {
            if (!currentUnreadMarker) {
                return;
            }

            const unreadMessageIndex = sortedVisibleReportActions.findIndex((action) => action.reportActionID === currentUnreadMarker);

            if (unreadMessageIndex !== -1) {
                // We're passing viewPosition: 1 since we're using an InvertedFlatList.
                reportScrollManager?.scrollToIndex(unreadMessageIndex, false, 1);
            }
        };

        // Call the scroll function after a small delay to ensure all items 
        // have been measured and the list is ready to be scrolled.
        InteractionManager.runAfterInteractions(scrollToFirstUnreadMessage);
        // We only want to run this effect once, when we're navigating to a report with unread messages.
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [sortedVisibleReportActions]);

Besides the above new useEffect code introduced as part of this new feature, here's a test branch test/35011 and the diff in order to review all the changes introduced as part of this feature, including the scrollToIndex related changes for both web / native platforms.

Additionally: (did not add this to the current solution) we could also introduce the viewOffset argument to the scrollToIndex function if we want some additional offset such that the new unread message marker would have better visibility if in the below picture example it's not visible enough (current solution, also see videos):

Screenshot 2024-04-27 at 18 35 53

Video results

MacOS: Chrome / Safari

https://github.com/Expensify/App/assets/56457735/c37e15f1-17c4-4bc7-b357-c94e01cbcc2e

iOS: Native

https://github.com/Expensify/App/assets/56457735/e4282338-310e-44d3-97b2-447ebf7d2fb6

Android: mWeb

https://github.com/Expensify/App/assets/56457735/9a00be14-b09d-40d9-bae3-4171605fe83a

ikevin127 avatar Apr 28 '24 01:04 ikevin127

@trjExpensify, @mollfpr Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Apr 30 '24 18:04 melvin-bot[bot]

@mollfpr can you review this proposal please? CC: @roryabraham feels like one you'd be interested in as well. :)

trjExpensify avatar May 01 '24 11:05 trjExpensify

Sorry for the delay πŸ™

The @ikevin127 proposal looks good to me!

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed!

mollfpr avatar May 01 '24 16:05 mollfpr

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

melvin-bot[bot] avatar May 01 '24 16:05 melvin-bot[bot]

πŸ“£ @ikevin127 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer 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[bot] avatar May 01 '24 17:05 melvin-bot[bot]

PR https://github.com/Expensify/App/pull/41448 ready for review! πŸš€

ikevin127 avatar May 01 '24 20:05 ikevin127

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] avatar May 13 '24 15:05 melvin-bot[bot]