1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-12-10 05:42:29 +03:00

Show a tile at beginning of visible history (#5887)

This commit is contained in:
Robin
2022-01-20 04:51:31 -05:00
committed by GitHub
parent c4fc20018d
commit f59ea6d7ad
6 changed files with 83 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ import { hasText } from "../../TextForEvent";
import IRCTimelineProfileResizer from "../views/elements/IRCTimelineProfileResizer";
import DMRoomMap from "../../utils/DMRoomMap";
import NewRoomIntro from "../views/rooms/NewRoomIntro";
import HistoryTile from "../views/rooms/HistoryTile";
import { replaceableComponent } from "../../utils/replaceableComponent";
import defaultDispatcher from '../../dispatcher/dispatcher';
import CallEventGrouper from "./CallEventGrouper";
@@ -129,8 +130,8 @@ interface IProps {
// for pending messages.
ourUserId?: string;
// true to suppress the date at the start of the timeline
suppressFirstDateSeparator?: boolean;
// whether the timeline can visually go back any further
canBackPaginate?: boolean;
// whether to show read receipts
showReadReceipts?: boolean;
@@ -823,7 +824,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
if (prevEvent == null) {
// first event in the panel: depends if we could back-paginate from
// here.
return !this.props.suppressFirstDateSeparator;
return !this.props.canBackPaginate;
}
return wantsDateSeparator(prevEvent.getDate(), nextEventDate);
}
@@ -1365,6 +1366,12 @@ class MemberGrouper extends BaseGrouper {
eventTiles = null;
}
// If a membership event is the start of visible history, tell the user
// why they can't see earlier messages
if (!this.panel.props.canBackPaginate && !this.prevEvent) {
ret.push(<HistoryTile key="historytile" />);
}
ret.push(
<MemberEventListSummary
key={key}

View File

@@ -1574,7 +1574,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
highlightedEventId={this.props.highlightedEventId}
readMarkerEventId={this.state.readMarkerEventId}
readMarkerVisible={this.state.readMarkerVisible}
suppressFirstDateSeparator={this.state.canBackPaginate}
canBackPaginate={this.state.canBackPaginate && this.state.firstVisibleEventIndex === 0}
showUrlPreview={this.props.showUrlPreview}
showReadReceipts={this.props.showReadReceipts}
ourUserId={MatrixClientPeg.get().credentials.userId}