@@ -29,6 +29,7 @@ import { logger } from "matrix-js-sdk/src/logger";
29
29
import { ClientEvent } from "matrix-js-sdk/src/client" ;
30
30
import { Thread } from 'matrix-js-sdk/src/models/thread' ;
31
31
import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts" ;
32
+ import { MatrixError } from 'matrix-js-sdk/src/http-api' ;
32
33
33
34
import SettingsStore from "../../settings/SettingsStore" ;
34
35
import { Layout } from "../../settings/enums/Layout" ;
@@ -1263,9 +1264,8 @@ class TimelinePanel extends React.Component<IProps, IState> {
1263
1264
* @param {boolean? } scrollIntoView whether to scroll the event into view.
1264
1265
*/
1265
1266
private loadTimeline ( eventId ?: string , pixelOffset ?: number , offsetBase ?: number , scrollIntoView = true ) : void {
1266
- this . timelineWindow = new TimelineWindow (
1267
- MatrixClientPeg . get ( ) , this . props . timelineSet ,
1268
- { windowLimit : this . props . timelineCap } ) ;
1267
+ const cli = MatrixClientPeg . get ( ) ;
1268
+ this . timelineWindow = new TimelineWindow ( cli , this . props . timelineSet , { windowLimit : this . props . timelineCap } ) ;
1269
1269
1270
1270
const onLoaded = ( ) => {
1271
1271
if ( this . unmounted ) return ;
@@ -1290,8 +1290,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
1290
1290
// we're in a setState callback, and we know
1291
1291
// timelineLoading is now false, so render() should have
1292
1292
// mounted the message panel.
1293
- logger . log ( "can't initialise scroll state because " +
1294
- "messagePanel didn't load" ) ;
1293
+ logger . log ( "can't initialise scroll state because messagePanel didn't load" ) ;
1295
1294
return ;
1296
1295
}
1297
1296
@@ -1305,15 +1304,13 @@ class TimelinePanel extends React.Component<IProps, IState> {
1305
1304
} ) ;
1306
1305
} ;
1307
1306
1308
- const onError = ( error ) => {
1307
+ const onError = ( error : MatrixError ) => {
1309
1308
if ( this . unmounted ) return ;
1310
1309
1311
1310
this . setState ( { timelineLoading : false } ) ;
1312
- logger . error (
1313
- `Error loading timeline panel at ${ eventId } : ${ error } ` ,
1314
- ) ;
1311
+ logger . error ( `Error loading timeline panel at ${ this . props . timelineSet . room ?. roomId } /${ eventId } : ${ error } ` ) ;
1315
1312
1316
- let onFinished ;
1313
+ let onFinished : ( ) => void ;
1317
1314
1318
1315
// if we were given an event ID, then when the user closes the
1319
1316
// dialog, let's jump to the end of the timeline. If we weren't,
@@ -1329,22 +1326,24 @@ class TimelinePanel extends React.Component<IProps, IState> {
1329
1326
} ) ;
1330
1327
} ;
1331
1328
}
1332
- let message ;
1329
+
1330
+ let description : string ;
1333
1331
if ( error . errcode == 'M_FORBIDDEN' ) {
1334
- message = _t (
1332
+ description = _t (
1335
1333
"Tried to load a specific point in this room's timeline, but you " +
1336
1334
"do not have permission to view the message in question." ,
1337
1335
) ;
1338
1336
} else {
1339
- message = _t (
1337
+ description = _t (
1340
1338
"Tried to load a specific point in this room's timeline, but was " +
1341
1339
"unable to find it." ,
1342
1340
) ;
1343
1341
}
1342
+
1344
1343
Modal . createTrackedDialog ( 'Failed to load timeline position' , '' , ErrorDialog , {
1345
1344
title : _t ( "Failed to load timeline position" ) ,
1346
- description : message ,
1347
- onFinished : onFinished ,
1345
+ description,
1346
+ onFinished,
1348
1347
} ) ;
1349
1348
} ;
1350
1349
0 commit comments