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

Fix: Messages marked as read incorrectly for last chat #2553

Merged
merged 4 commits into from
Apr 27, 2021
Merged
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
34 changes: 21 additions & 13 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import Visibility from '../../../libs/Visibility';
import Timing from '../../../libs/actions/Timing';
import CONST from '../../../CONST';
import themeColors from '../../../styles/themes/default';
import Navigation from '../../../libs/Navigation/Navigation';
import compose from '../../../libs/compose';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
Julesssss marked this conversation as resolved.
Show resolved Hide resolved

const propTypes = {
// The ID of the report actions will be created for
Expand All @@ -50,6 +53,8 @@ const propTypes = {
// Email of the logged in person
email: PropTypes.string,
}),

...windowDimensionsPropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -121,7 +126,7 @@ class ReportActionsView extends React.Component {

// When the last action changes, wait three seconds, then record the max action
// This will make the unread indicator go away if you receive comments in the same chat you're looking at
if (Visibility.isVisible()) {
if (Visibility.isVisible() && !(Navigation.isDrawerOpen() && this.props.isSmallScreenWidth)) {
this.timers.push(setTimeout(this.recordMaxAction, 3000));
}
}
Expand Down Expand Up @@ -327,15 +332,18 @@ class ReportActionsView extends React.Component {
ReportActionsView.propTypes = propTypes;
ReportActionsView.defaultProps = defaultProps;

export default withOnyx({
report: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
},
reportActions: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
canEvict: false,
},
session: {
key: ONYXKEYS.SESSION,
},
})(ReportActionsView);
export default compose(
withWindowDimensions,
withOnyx({
report: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
},
reportActions: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
canEvict: false,
},
session: {
key: ONYXKEYS.SESSION,
},
}),
)(ReportActionsView);