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

Allow App to Navigate to Last Visited Room On visiting with HOME url #6978

Merged
merged 4 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1267,11 +1267,6 @@ function updateLastReadActionID(reportID, sequenceNumber) {
// (sequenceNumber - 1) || reportMaxSequenceNumbers[reportID] because the first expression results in 0 which is falsy.
const lastReadSequenceNumber = _.isNumber(sequenceNumber) ? (sequenceNumber - 1) : reportMaxSequenceNumbers[reportID];

// We call this method in many cases where there's nothing to update because we already updated it, so we avoid
// doing an unnecessary server call if the last read is the same one we had already
if (lastReadSequenceNumbers[reportID] === lastReadSequenceNumber) {
return;
}
setLocalLastRead(reportID, lastReadSequenceNumber);

// Mark the report as not having any unread items
Expand Down
11 changes: 5 additions & 6 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class ReportActionsView extends React.Component {

this.renderItem = this.renderItem.bind(this);
this.renderCell = this.renderCell.bind(this);
this.scrollToListBottom = this.scrollToListBottom.bind(this);
this.scrollToBottomAndUpdateLastRead = this.scrollToBottomAndUpdateLastRead.bind(this);
this.onVisibilityChange = this.onVisibilityChange.bind(this);
this.recordTimeToMeasureItemLayout = this.recordTimeToMeasureItemLayout.bind(this);
this.loadMoreChats = this.loadMoreChats.bind(this);
Expand Down Expand Up @@ -140,8 +140,7 @@ class ReportActionsView extends React.Component {
if (!ReportActionComposeFocusManager.isFocused()) {
return;
}

this.scrollToListBottom();
ReportScrollManager.scrollToBottom()
K4tsuki marked this conversation as resolved.
Show resolved Hide resolved
});

this.updateUnreadIndicatorPosition(this.props.report.unreadActionCount);
Expand Down Expand Up @@ -211,7 +210,7 @@ class ReportActionsView extends React.Component {
// leave the user positioned where they are now in the list.
const lastAction = CollectionUtils.lastItem(this.props.reportActions);
if (lastAction && (lastAction.actorEmail === this.props.session.email)) {
this.scrollToListBottom();
ReportScrollManager.scrollToBottom()
K4tsuki marked this conversation as resolved.
Show resolved Hide resolved
}

if (lodashGet(lastAction, 'actorEmail', '') !== lodashGet(this.props.session, 'email', '')) {
Expand Down Expand Up @@ -380,7 +379,7 @@ class ReportActionsView extends React.Component {
* items have been rendered. If the number of actions has changed since it was last rendered, then
* scroll the list to the end. As a report can contain non-message actions, we should confirm that list data exists.
*/
scrollToListBottom() {
scrollToBottomAndUpdateLastRead(){
K4tsuki marked this conversation as resolved.
Show resolved Hide resolved
ReportScrollManager.scrollToBottom();
Report.updateLastReadActionID(this.props.reportID);
}
Expand Down Expand Up @@ -557,7 +556,7 @@ class ReportActionsView extends React.Component {
<MarkerBadge
active={this.state.isMarkerActive}
count={this.state.localUnreadActionCount}
onClick={this.scrollToListBottom}
onClick={this.scrollToBottomAndUpdateLastRead}
onClose={this.hideMarker}
/>
<InvertedFlatList
Expand Down