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

This commit is contained in:
Germain 2021-12-01 15:45:31 +00:00 committed by GitHub
parent 279caecde7
commit 3d4ece02e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions

View file

@ -242,10 +242,11 @@ export default class ThreadView extends React.Component<IProps, IState> {
{ this.state.thread && ( { this.state.thread && (
<TimelinePanel <TimelinePanel
ref={this.timelinePanelRef} ref={this.timelinePanelRef}
showReadReceipts={false} // No RR support in thread's MVP showReadReceipts={false} // Hide the read receipts
manageReadReceipts={false} // No RR support in thread's MVP // until homeservers speak threads language
manageReadMarkers={false} // No RM support in thread's MVP manageReadReceipts={true}
sendReadReceiptOnLoad={false} // No RR support in thread's MVP manageReadMarkers={true}
sendReadReceiptOnLoad={true}
timelineSet={this.state?.thread?.timelineSet} timelineSet={this.state?.thread?.timelineSet}
showUrlPreview={true} showUrlPreview={true}
tileShape={TileShape.Thread} tileShape={TileShape.Thread}

View file

@ -28,7 +28,7 @@ import SettingsStore from "../../settings/SettingsStore";
import { Layout } from "../../settings/enums/Layout"; import { Layout } from "../../settings/enums/Layout";
import { _t } from '../../languageHandler'; import { _t } from '../../languageHandler';
import { MatrixClientPeg } from "../../MatrixClientPeg"; import { MatrixClientPeg } from "../../MatrixClientPeg";
import RoomContext from "../../contexts/RoomContext"; import RoomContext, { TimelineRenderingType } from "../../contexts/RoomContext";
import UserActivity from "../../UserActivity"; import UserActivity from "../../UserActivity";
import Modal from "../../Modal"; import Modal from "../../Modal";
import dis from "../../dispatcher/dispatcher"; import dis from "../../dispatcher/dispatcher";
@ -1310,12 +1310,17 @@ class TimelinePanel extends React.Component<IProps, IState> {
} }
private indexForEventId(evId: string): number | null { private indexForEventId(evId: string): number | null {
for (let i = 0; i < this.state.events.length; ++i) { /* Threads do not have server side support for read receipts and the concept
if (evId == this.state.events[i].getId()) { is very tied to the main room timeline, we are forcing the timeline to
return i; send read receipts for threaded events */
} const isThreadTimeline = this.context.timelineRenderingType === TimelineRenderingType.Thread;
if (SettingsStore.getValue("feature_thread") && isThreadTimeline) {
return 0;
} }
return null; const index = this.state.events.findIndex(ev => ev.getId() === evId);
return index > -1
? index
: null;
} }
private getLastDisplayedEventIndex(opts: IEventIndexOpts = {}): number | null { private getLastDisplayedEventIndex(opts: IEventIndexOpts = {}): number | null {

View file

@ -1294,6 +1294,7 @@ export default class EventTile extends React.Component<IProps, IState> {
case TileShape.Thread: { case TileShape.Thread: {
const room = this.context.getRoom(this.props.mxEvent.getRoomId()); const room = this.context.getRoom(this.props.mxEvent.getRoomId());
return React.createElement(this.props.as || "li", { return React.createElement(this.props.as || "li", {
"ref": this.ref,
"className": classes, "className": classes,
"aria-live": ariaLive, "aria-live": ariaLive,
"aria-atomic": true, "aria-atomic": true,