Use updates stable relations from js-sdk (#8715)
* Use updates stable relations from js-sdk * Relations is now accessible on the Room instead * Reuse more existing code and ditch confusing `isThreadRelation` * Fix last usage of removed `isThreadRelation` * Update tests to match removal of isThreadRelation * Tweak method naming to closer match spec * Fix missing method name change
This commit is contained in:
parent
56b0b79fb7
commit
21d0aaf524
8 changed files with 26 additions and 54 deletions
|
@ -469,12 +469,9 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
|||
|
||||
// TODO: Implement granular (per-room) hide options
|
||||
public shouldShowEvent(mxEv: MatrixEvent, forceHideEvents = false): boolean {
|
||||
if (this.props.hideThreadedMessages && this.threadsEnabled) {
|
||||
if (mxEv.isThreadRelation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.shouldLiveInThreadOnly(mxEv)) {
|
||||
if (this.props.hideThreadedMessages && this.threadsEnabled && this.props.room) {
|
||||
const { shouldLiveInRoom } = this.props.room.eventShouldLiveIn(mxEv, this.props.events);
|
||||
if (!shouldLiveInRoom) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -497,24 +494,6 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
|||
return !shouldHideEvent(mxEv, this.context);
|
||||
}
|
||||
|
||||
private shouldLiveInThreadOnly(event: MatrixEvent): boolean {
|
||||
const associatedId = event.getAssociatedId();
|
||||
|
||||
const targetsThreadRoot = event.threadRootId === associatedId;
|
||||
if (event.isThreadRoot || targetsThreadRoot || !event.isThreadRelation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this is a reply, then we use the associated event to decide whether
|
||||
// this should be thread only or not
|
||||
const parentEvent = this.props.room.findEventById(associatedId);
|
||||
if (parentEvent) {
|
||||
return this.shouldLiveInThreadOnly(parentEvent);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public readMarkerForEvent(eventId: string, isLastEvent: boolean): ReactNode {
|
||||
const visible = !isLastEvent && this.props.readMarkerVisible;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue