Fix #20026: send read marker as soon as we change it (#8802)

This commit is contained in:
Andy Balaam 2022-06-09 14:41:09 +01:00 committed by GitHub
parent d9396b0b54
commit 4e1958d9fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 105 additions and 2 deletions

View file

@ -1115,11 +1115,12 @@ class TimelinePanel extends React.Component<IProps, IState> {
public forgetReadMarker = (): void => {
if (!this.props.manageReadMarkers) return;
// Find the read receipt - we will set the read marker to this
const rmId = this.getCurrentReadReceipt();
// see if we know the timestamp for the rr event
// Look up the timestamp if we can find it
const tl = this.props.timelineSet.getTimelineForEvent(rmId);
let rmTs;
let rmTs: number;
if (tl) {
const event = tl.getEvents().find((e) => { return e.getId() == rmId; });
if (event) {
@ -1127,7 +1128,11 @@ class TimelinePanel extends React.Component<IProps, IState> {
}
}
// Update the read marker to the values we found
this.setReadMarker(rmId, rmTs);
// Send the receipts to the server immediately (don't wait for activity)
this.sendReadReceipt();
};
/* return true if the content is fully scrolled down and we are