Correctly handle Room.timeline events which have a nullable Room
(#7635)
This commit is contained in:
parent
d239697384
commit
8e4ced6454
10 changed files with 62 additions and 55 deletions
|
@ -23,7 +23,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import { RoomState } from "matrix-js-sdk/src/models/room-state";
|
||||
import { EventTimeline } from "matrix-js-sdk/src/models/event-timeline";
|
||||
import { IRoomTimelineData } from "matrix-js-sdk/src/models/event-timeline-set";
|
||||
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import QueryMatcher from './QueryMatcher';
|
||||
|
@ -42,11 +42,6 @@ const USER_REGEX = /\B@\S*/g;
|
|||
// to allow you to tab-complete /mat into /(matthew)
|
||||
const FORCED_USER_REGEX = /[^/,:; \t\n]\S*/g;
|
||||
|
||||
interface IRoomTimelineData {
|
||||
timeline: EventTimeline;
|
||||
liveEvent?: boolean;
|
||||
}
|
||||
|
||||
export default class UserProvider extends AutocompleteProvider {
|
||||
matcher: QueryMatcher<RoomMember>;
|
||||
users: RoomMember[];
|
||||
|
@ -78,12 +73,12 @@ export default class UserProvider extends AutocompleteProvider {
|
|||
|
||||
private onRoomTimeline = (
|
||||
ev: MatrixEvent,
|
||||
room: Room,
|
||||
room: Room | null,
|
||||
toStartOfTimeline: boolean,
|
||||
removed: boolean,
|
||||
data: IRoomTimelineData,
|
||||
) => {
|
||||
if (!room) return;
|
||||
if (!room) return; // notification timeline, we'll get this event again with a room specific timeline
|
||||
if (removed) return;
|
||||
if (room.roomId !== this.room.roomId) return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue