-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[MM-24436]- Add a threshold from bottom for new messages toast #5828
Conversation
Thanks @sridhar02 for the pull request! Per the CONTRIBUTING.md file displayed when you created this pull request, we need to add you to the list of approved contributors for the Mattermost project. Please help complete the Mattermost contribution license agreement? This is a standard procedure for many open source projects. Your form should be processed within 24 hours and reviewers for your pull request will be able to proceed. Please let us know if you have any questions. We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team. |
/check-cla |
@sridhar02 Hey, BUFFER_TO_BE_CONSIDERED_BOTTOM is used for determining if the scroll view is at the bottom. we give a 10px buffer and still consider it as bottom. This value is used for various states like if user is at the bottom and he receives a new message, view is auto scrolled to the bottom. Now with this change even if user is 999px he is autoscrolled to the bottom. The way to implement is to have a look at Hope this helps. You can reach out to me incase of questions |
@sudheerDev can u recheck the PR, i have changed the logic to |
@@ -84,7 +84,7 @@ class ToastWrapper extends React.PureComponent { | |||
} | |||
|
|||
// show unread toast on mount when channel is not at bottom and unread count greater than 0 | |||
if (typeof showUnreadToast === 'undefined' && props.atBottom !== null) { | |||
if (typeof showUnreadToast === 'undefined' && props.atBottom !== null && props.initScrollOffsetFromBottom > 1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want toast value to be either true
or false
, but for assigning the value to showUnreadToast
we need to wait for the scroll position to be set i.e wait for view to scroll to position for new message etc hence we set the first value at this condition.
if (typeof showUnreadToast === 'undefined' && props.atBottom !== null) {
This is true when a component is mounted and scroll position is set for the first time because props.atBottom
will be not be null anymore. But if change it to
if (typeof showUnreadToast === 'undefined' && props.atBottom !== null && props.initScrollOffsetFromBottom > 1000) {
Then it will not set the initial value of showUnreadToast
anymore.
Instead this should be
if (typeof showUnreadToast === 'undefined' && props.atBottom !== null) {
showUnreadToast = unreadCount > 0 && props.initScrollOffsetFromBottom > 1000;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I will change the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks good, Can you add a test case for less than 1000px?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I have added a new test case for less than 1000px
2b08dc8
to
72baa36
Compare
@@ -85,7 +85,7 @@ class ToastWrapper extends React.PureComponent { | |||
|
|||
// show unread toast on mount when channel is not at bottom and unread count greater than 0 | |||
if (typeof showUnreadToast === 'undefined' && props.atBottom !== null) { | |||
showUnreadToast = unreadCount > 0 && !props.atBottom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nitpick, can this 1000
scroll be a named constant so it can be more easily read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes done
minor change, not even a blocking one |
@sudheerDev @sridhar02 is this ready for re-review? |
@esethna yes, this PR is ready for the re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing the new message line indicator appear very briefly before disappearing if the channel is within the threshold of 1000px
@esethna if there is an issue with the PR, mention it, I will try to resolve it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@sridhar02 Hey Thanks for working on the feature, in future try to avoid force pushing the commits. Like in this case QA reviews are done and i see commit history changed and it would be hard to judge if you made any new changes after that |
Test server destroyed |
1 similar comment
Test server destroyed |
…o MM-20457 * 'master' of github.com:Tak-Iwamoto/mattermost-webapp: (87 commits) MM-T644 Integrations display on team where they were created (mattermost#6752) [MM-20478] Migrate post_header module to TypeScript (mattermost#6631) [MM-20599] Migrated select_team component to Typescript (mattermost#6574) MM-20554 Migrate 'components/delete_post_modal' module and associated tests to TypeScript (mattermost#6656) [MM-24436]- Add a threshold from bottom for new messages toast (mattermost#5828) [MM-20489] Migrate failed_post_options and its tests to typescript (mattermost#6717) [MM-28063] Cloud Telemetry - Admin Console (mattermost#6762) [MM-29559][MM-29558] Company Info Fixes (mattermost#6764) [MM-29557] [MM-29590] Update subscription when purchase modal closes (mattermost#6765) [MM-29615] Fixed subscription page so it doesn't load until subscription info is loaded (mattermost#6766) [MM-28064] Add telemetry in various places around cloud message banners (mattermost#6763) migrate changeCSS function CSS variable for mobile CSS .tutorial-steps__container selector. (mattermost#6743) [MM-27231]: cypress test for MM-T1837 (mattermost#6676) [MM-28062] Add telemetry for in-app purchase flow (mattermost#6760) MM-27454 - Contact Us and Billing Documentation Links (mattermost#6731) [MM-20514] Migrates components/password reset send link to typescript (mattermost#6584) Cloud Billing polish Soft GA (mattermost#6740) [MM-28221] Payment Info Edit/View (mattermost#6709) MM-T636 Description field for incoming and outgoing webhooks can hold 500 characters (mattermost#6682) Translations update from Weblate (mattermost#6748) ...
/cherry-pick release-5.29 |
Cherry pick is scheduled. |
…rmost#5828) * Changed the buffer value to be considered from bottom for the toast message * test value changes related to isAtBottom function * Changes are set to previous values as this is not right approach * added the condition for the offset from bottom greater than 1000px * Change the test conditions according to new condition to show the toast message * logic change * eslint corrections * added a test that fails if the scroll from bottom is less than 1000px * add constant THRESHOLD_FROM_BOTTOM and replace 1000 value * Bug fix for toast flashing when you mark as unread * bug fix * tests resolved (cherry picked from commit 855633d)
#6850) * Changed the buffer value to be considered from bottom for the toast message * test value changes related to isAtBottom function * Changes are set to previous values as this is not right approach * added the condition for the offset from bottom greater than 1000px * Change the test conditions according to new condition to show the toast message * logic change * eslint corrections * added a test that fails if the scroll from bottom is less than 1000px * add constant THRESHOLD_FROM_BOTTOM and replace 1000 value * Bug fix for toast flashing when you mark as unread * bug fix * tests resolved (cherry picked from commit 855633d) Co-authored-by: Sridhar <kattasridhar02@gmail.com>
* Changed the buffer value to be considered from bottom for the toast message * test value changes related to isAtBottom function * Changes are set to previous values as this is not right approach * added the condition for the offset from bottom greater than 1000px * Change the test conditions according to new condition to show the toast message * logic change * eslint corrections * added a test that fails if the scroll from bottom is less than 1000px * add constant THRESHOLD_FROM_BOTTOM and replace 1000 value * Bug fix for toast flashing when you mark as unread * bug fix * tests resolved
* Changed the buffer value to be considered from bottom for the toast message * test value changes related to isAtBottom function * Changes are set to previous values as this is not right approach * added the condition for the offset from bottom greater than 1000px * Change the test conditions according to new condition to show the toast message * logic change * eslint corrections * added a test that fails if the scroll from bottom is less than 1000px * add constant THRESHOLD_FROM_BOTTOM and replace 1000 value * Bug fix for toast flashing when you mark as unread * bug fix * tests resolved
* Revert "MM-29929 Fix for unread messages toast on marking channel as unread (mattermost#7028)" This reverts commit 92f5d86. * Revert "[MM-24436]- Add a threshold from bottom for new messages toast (mattermost#5828)" This reverts commit 855633d. (cherry picked from commit 3e429f7)
* Revert "MM-29929 Fix for unread messages toast on marking channel as unread (mattermost#7028)" This reverts commit 92f5d86. * Revert "[MM-24436]- Add a threshold from bottom for new messages toast (mattermost#5828)" This reverts commit 855633d. (cherry picked from commit 3e429f7)
* Revert "MM-29929 Fix for unread messages toast on marking channel as unread (#7028)" This reverts commit 92f5d86. * Revert "[MM-24436]- Add a threshold from bottom for new messages toast (#5828)" This reverts commit 855633d. (cherry picked from commit 3e429f7) Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Summary
Changed the buffer value to be considered from bottom for the toast message
Ticket Link
Fixes mattermost/mattermost#14904
JIRA https://mattermost.atlassian.net/browse/MM-24436