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

Commit

Permalink
Fix regression around haveRendererForEvent for hidden events (#8379)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Apr 21, 2022
1 parent 399ac61 commit bbe0c94
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,6 @@ export default class MessagePanel extends React.Component<IProps, IState> {
}
}

/* check the scroll state and send out pagination requests if necessary.
*/
public checkFillState(): void {
if (this.scrollPanel.current) {
this.scrollPanel.current.checkFillState();
}
}

private isUnmounting = (): boolean => {
return !this.isMounted;
};
Expand Down
2 changes: 2 additions & 0 deletions src/events/EventTileFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ export function haveRendererForEvent(mxEvent: MatrixEvent, showHiddenEvents: boo
return hasText(mxEvent, showHiddenEvents);
} else if (handler === STATE_EVENT_TILE_TYPES[EventType.RoomCreate]) {
return Boolean(mxEvent.getContent()['predecessor']);
} else if (handler === JSONEventFactory) {
return false;
} else {
return true;
}
Expand Down
39 changes: 38 additions & 1 deletion test/components/structures/MessagePanel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class WrappedMessagePanel extends React.Component {
callEventGroupers = new Map();

render() {
const { showHiddenEvents, ...props } = this.props;

const roomContext = {
room,
roomId: room.roomId,
Expand All @@ -54,13 +56,14 @@ class WrappedMessagePanel extends React.Component {
showJoinLeaves: false,
showAvatarChanges: false,
showDisplaynameChanges: true,
showHiddenEvents,
};

return <MatrixClientContext.Provider value={client}>
<RoomContext.Provider value={roomContext}>
<MessagePanel
room={room}
{...this.props}
{...props}
resizeNotifier={this.resizeNotifier}
callEventGroupers={this.callEventGroupers}
/>
Expand Down Expand Up @@ -633,6 +636,40 @@ describe('MessagePanel', function() {
expect(settingsSpy).not.toHaveBeenCalledWith("showHiddenEventsInTimeline");
settingsSpy.mockRestore();
});

it("should group hidden event reactions into an event list summary", () => {
const events = [
TestUtilsMatrix.mkEvent({
event: true,
type: "m.reaction",
room: "!room:id",
user: "@user:id",
content: {},
ts: 1,
}),
TestUtilsMatrix.mkEvent({
event: true,
type: "m.reaction",
room: "!room:id",
user: "@user:id",
content: {},
ts: 2,
}),
TestUtilsMatrix.mkEvent({
event: true,
type: "m.reaction",
room: "!room:id",
user: "@user:id",
content: {},
ts: 3,
}),
];
const res = mount(<WrappedMessagePanel showHiddenEvents={true} events={events} />);

const els = res.find("EventListSummary");
expect(els.length).toEqual(1);
expect(els.prop("events").length).toEqual(3);
});
});

describe("shouldFormContinuation", () => {
Expand Down

0 comments on commit bbe0c94

Please sign in to comment.