-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Remove unreadActionCount
& Improve Global Indicators
#10739
Conversation
Okaiee this is ready for reviews now :D |
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.
code looks clean, great job, going to test now!
|
||
// Stash the unread action counts for each report | ||
const unreadActionCounts = {}; | ||
// Stash the reports |
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.
// Stash the reports |
updateUnread(totalCount); | ||
}, 1000, {leading: false}); | ||
}, 300, {leading: false}); |
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.
Curious why this changed from 1000 to 300
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.
Oh no particular reason - this is leftover from testing and I think not needed.
return; | ||
} | ||
|
||
const totalCount = _.reduce(reports, (total, report) => total + (ReportUtils.isUnread(report) ? 1 : 0), 0); |
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.
const totalCount = _.reduce(reports, (total, report) => total + (ReportUtils.isUnread(report) ? 1 : 0), 0); | |
const totalCount = _.filter(reports, ReportUtils.isUnread).length |
NAB, just a suggestion
@@ -214,6 +212,9 @@ class ReportActionsView extends React.Component { | |||
} else if (this.state.newMarkerSequenceNumber === 0) { | |||
this.setState({newMarkerSequenceNumber: currentLastSequenceNumber}); | |||
} | |||
} else if (this.state.newMarkerSequenceNumber === 0) { | |||
// The report is not in view so we will update the newMarkerSequenceNumber |
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.
Update to the last one so nothing shows as unread?
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.
Ah so, the condition here is:
- report isn't in view
- a new message appeared from someone besides the current user
- no previous marker is set
So we will update the new marker with this sequenceNumber
. This basically fixes a bug found by QA here: #10768
@marcaaron Tests well 🎉 But a bit confused about these steps:
So click the New Message, scorll down, dont errase the What is a bit unintuitive for me is that I mark old comment as unread and then I mark newer comment as unread but the New marker is moved to the newer comment. Should the marker not stay with the older comment marked as unread as it is technically the oldest comment "I did not read"? |
@@ -214,6 +212,10 @@ class ReportActionsView extends React.Component { | |||
} else if (this.state.newMarkerSequenceNumber === 0) { | |||
this.setState({newMarkerSequenceNumber: currentLastSequenceNumber}); | |||
} | |||
} else if (this.state.newMarkerSequenceNumber === 0) { | |||
// The report is not in view and we received a comment from another user while the new marker is not set | |||
// so we wil set the new marker now. |
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.
<3
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.
NAB: Typo
yes exactly this! I updated the steps to make it clearer, thanks!
No, in the case of manually marking a comment as unread the user is telling us they want to manually override the unread position. |
Updated thanks for the reviews! 🙇♂️ |
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
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.
This has been simplified quite a bit, thanks for these changes!
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.
No, in the case of manually marking a comment as unread the user is telling us they want to manually override the unread position.
Coolio! Thanks
@marcaaron looks like this was merged without passing tests. Please add a note explaining why this was done and remove the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Did pass the tests. |
🚀 Deployed to staging by @marcaaron in version: 1.1.97-0 🚀
|
Details
Removes
unreadActionCount
in favor of boolean unread statusFixed Issues
$ https://github.com/Expensify/Expensify/issues/226118
$ #10768
Tests
Testing Global Unread Indicator
Testing Unread LHN Status, “New Messages” badge, and New Line Indicator
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Screenshots
Web
Mobile Web
Desktop
iOS
Android