Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Send read receipts for events in thread's timeline #7229

Merged
merged 4 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
9 changes: 5 additions & 4 deletions src/components/structures/ThreadView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ export default class ThreadView extends React.Component<IProps, IState> {
{ this.state.thread && (
<TimelinePanel
ref={this.timelinePanelRef}
showReadReceipts={false} // No RR support in thread's MVP
manageReadReceipts={false} // No RR support in thread's MVP
manageReadMarkers={false} // No RM support in thread's MVP
sendReadReceiptOnLoad={false} // No RR support in thread's MVP
showReadReceipts={false} // Hide the read receipts
// until homeservers speak threads language
manageReadReceipts={true}
manageReadMarkers={true}
sendReadReceiptOnLoad={true}
timelineSet={this.state?.thread?.timelineSet}
showUrlPreview={true}
tileShape={TileShape.Thread}
Expand Down
6 changes: 1 addition & 5 deletions src/components/structures/TimelinePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ class TimelinePanel extends React.Component<IProps, IState> {
let shouldSendRR = true;

const currentRREventId = this.getCurrentReadReceipt(true);
const currentRREventIndex = this.indexForEventId(currentRREventId);
germain-gg marked this conversation as resolved.
Show resolved Hide resolved
// We want to avoid sending out read receipts when we are looking at
// events in the past which are before the latest RR.
//
Expand All @@ -745,7 +744,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
// RRs) - but that is a bit of a niche case. It will sort itself out when
// the user eventually hits the live timeline.
//
if (currentRREventId && currentRREventIndex === null &&
if (currentRREventId &&
this.timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
shouldSendRR = false;
}
Expand All @@ -758,9 +757,6 @@ class TimelinePanel extends React.Component<IProps, IState> {
}
let lastReadEvent = this.state.events[lastReadEventIndex];
shouldSendRR = shouldSendRR &&
// Only send a RR if the last read event is ahead in the timeline relative to
// the current RR event.
lastReadEventIndex > currentRREventIndex &&
// Only send a RR if the last RR set != the one we would send
this.lastRRSentEventId != lastReadEvent.getId();

Expand Down
1 change: 1 addition & 0 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,7 @@ export default class EventTile extends React.Component<IProps, IState> {
case TileShape.Thread: {
const room = this.context.getRoom(this.props.mxEvent.getRoomId());
return React.createElement(this.props.as || "li", {
"ref": this.ref,
"className": classes,
"aria-live": ariaLive,
"aria-atomic": true,
Expand Down