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

View file

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

View file

@ -170,7 +170,7 @@ const ForwardDialog: React.FC<IProps> = ({ matrixClient: cli, event, permalinkCr
userId, userId,
getAvatarUrl: (..._) => { getAvatarUrl: (..._) => {
return avatarUrlForUser( return avatarUrlForUser(
{avatarUrl: profileInfo.avatar_url}, { avatarUrl: profileInfo.avatar_url },
AVATAR_SIZE, AVATAR_SIZE, "crop", AVATAR_SIZE, AVATAR_SIZE, "crop",
); );
}, },