This commit is contained in:
Michael Telatynski 2021-06-29 22:21:05 +01:00
parent 8f4879ea96
commit a59e94b907
3 changed files with 10 additions and 13 deletions

View file

@ -814,7 +814,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
private collectEventNode = (eventId: string, node: EventTile): void => {
this.eventNodes[eventId] = node?.ref?.current;
}
};
// once dynamic content in the events load, make the scrollPanel check the
// scroll offsets.
@ -1085,7 +1085,7 @@ class CreationGrouper extends BaseGrouper {
class RedactionGrouper extends BaseGrouper {
static canStartGroup = function(panel: MessagePanel, ev: MatrixEvent): boolean {
return panel.shouldShowEvent(ev) && ev.isRedacted();
}
};
constructor(
panel: MessagePanel,
@ -1181,7 +1181,7 @@ class RedactionGrouper extends BaseGrouper {
class MemberGrouper extends BaseGrouper {
static canStartGroup = function(panel: MessagePanel, ev: MatrixEvent): boolean {
return panel.shouldShowEvent(ev) && membershipTypes.includes(ev.getType() as EventType);
}
};
constructor(
public readonly panel: MessagePanel,

View file

@ -374,7 +374,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
events,
liveEvents,
firstVisibleEventIndex,
}
};
// We can now paginate in the unpaginated direction
if (backwards) {
@ -885,15 +885,13 @@ class TimelinePanel extends React.Component<IProps, IState> {
if (this.timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
this.loadTimeline();
} else {
if (this.messagePanel.current) {
this.messagePanel.current.scrollToBottom();
}
this.messagePanel.current?.scrollToBottom();
}
};
public scrollToEventIfNeeded = (eventId: string): void => {
this.messagePanel.current?.scrollToEventIfNeeded(eventId);
}
};
/* scroll to show the read-up-to marker. We put it 1/3 of the way down
* the container.
@ -948,11 +946,10 @@ class TimelinePanel extends React.Component<IProps, IState> {
* at the end of the live timeline.
*/
public isAtEndOfLiveTimeline = (): boolean => {
return this.messagePanel.current
&& this.messagePanel.current.isAtBottom()
return this.messagePanel.current?.isAtBottom()
&& this.timelineWindow
&& !this.timelineWindow.canPaginate(EventTimeline.FORWARDS);
}
};
/* get the current scroll state. See ScrollPanel.getScrollState for
* details.