@@ -79,6 +79,7 @@ interface IProps {
79
79
tagId : TagID ;
80
80
showSkeleton ?: boolean ;
81
81
alwaysVisible ?: boolean ;
82
+ forceExpanded ?: boolean ;
82
83
resizeNotifier : ResizeNotifier ;
83
84
extraTiles ?: ReactComponentElement < typeof ExtraTile > [ ] ;
84
85
onListCollapse ?: ( isExpanded : boolean ) => void ;
@@ -460,6 +461,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
460
461
} ;
461
462
462
463
private toggleCollapsed = ( ) => {
464
+ if ( this . props . forceExpanded ) return ;
463
465
this . layout . isCollapsed = this . state . isExpanded ;
464
466
this . setState ( { isExpanded : ! this . layout . isCollapsed } ) ;
465
467
if ( this . props . onListCollapse ) {
@@ -508,15 +510,19 @@ export default class RoomSublist extends React.Component<IProps, IState> {
508
510
} ;
509
511
510
512
private renderVisibleTiles ( ) : React . ReactElement [ ] {
511
- if ( ! this . state . isExpanded ) {
513
+ if ( ! this . state . isExpanded && ! this . props . forceExpanded ) {
512
514
// don't waste time on rendering
513
515
return [ ] ;
514
516
}
515
517
516
518
const tiles : React . ReactElement [ ] = [ ] ;
517
519
518
520
if ( this . state . rooms ) {
519
- const visibleRooms = this . state . rooms . slice ( 0 , this . numVisibleTiles ) ;
521
+ let visibleRooms = this . state . rooms ;
522
+ if ( ! this . props . forceExpanded ) {
523
+ visibleRooms = visibleRooms . slice ( 0 , this . numVisibleTiles ) ;
524
+ }
525
+
520
526
for ( const room of visibleRooms ) {
521
527
tiles . push ( < RoomTile
522
528
room = { room }
@@ -537,7 +543,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
537
543
// to avoid spending cycles on slicing. It's generally fine to do this though
538
544
// as users are unlikely to have more than a handful of tiles when the extra
539
545
// tiles are used.
540
- if ( tiles . length > this . numVisibleTiles ) {
546
+ if ( tiles . length > this . numVisibleTiles && ! this . props . forceExpanded ) {
541
547
return tiles . slice ( 0 , this . numVisibleTiles ) ;
542
548
}
543
549
@@ -731,7 +737,13 @@ export default class RoomSublist extends React.Component<IProps, IState> {
731
737
} ) ;
732
738
733
739
let content = null ;
734
- if ( visibleTiles . length > 0 ) {
740
+ if ( visibleTiles . length > 0 && this . props . forceExpanded ) {
741
+ content = < div className = "mx_RoomSublist_resizeBox" >
742
+ < div className = "mx_RoomSublist_tiles" ref = { this . tilesRef } >
743
+ { visibleTiles }
744
+ </ div >
745
+ </ div > ;
746
+ } else if ( visibleTiles . length > 0 ) {
735
747
const layout = this . layout ; // to shorten calls
736
748
737
749
const minTiles = Math . min ( layout . minVisibleTiles , this . numTiles ) ;
0 commit comments