@@ -1597,14 +1597,15 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
1597
1597
} ;
1598
1598
1599
1599
private injectSticker ( url : string , info : object , text : string , threadId : string | null ) : void {
1600
- if ( ! this . context . client ) return ;
1600
+ const roomId = this . getRoomId ( ) ;
1601
+ if ( ! this . context . client || ! roomId ) return ;
1601
1602
if ( this . context . client . isGuest ( ) ) {
1602
1603
dis . dispatch ( { action : "require_registration" } ) ;
1603
1604
return ;
1604
1605
}
1605
1606
1606
1607
ContentMessages . sharedInstance ( )
1607
- . sendStickerContentToRoom ( url , this . getRoomId ( ) , threadId , info , text , this . context . client )
1608
+ . sendStickerContentToRoom ( url , roomId , threadId , info , text , this . context . client )
1608
1609
. then ( undefined , ( error ) => {
1609
1610
if ( error . name === "UnknownDeviceError" ) {
1610
1611
// Let the staus bar handle this
@@ -1636,7 +1637,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
1636
1637
private onSearchUpdate = ( inProgress : boolean , searchResults : ISearchResults | null ) : void => {
1637
1638
this . setState ( {
1638
1639
search : {
1639
- ...this . state . search ,
1640
+ ...this . state . search ! ,
1640
1641
count : searchResults ?. count ,
1641
1642
inProgress,
1642
1643
} ,
@@ -1658,10 +1659,12 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
1658
1659
} ;
1659
1660
1660
1661
private onRejectButtonClicked = ( ) : void => {
1662
+ const roomId = this . getRoomId ( ) ;
1663
+ if ( ! roomId ) return ;
1661
1664
this . setState ( {
1662
1665
rejecting : true ,
1663
1666
} ) ;
1664
- this . context . client ?. leave ( this . getRoomId ( ) ) . then (
1667
+ this . context . client ?. leave ( roomId ) . then (
1665
1668
( ) => {
1666
1669
dis . dispatch ( { action : Action . ViewHomePage } ) ;
1667
1670
this . setState ( {
@@ -1896,14 +1899,17 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
1896
1899
} ) ;
1897
1900
}
1898
1901
1899
- private onFileDrop = ( dataTransfer : DataTransfer ) : Promise < void > =>
1900
- ContentMessages . sharedInstance ( ) . sendContentListToRoom (
1902
+ private onFileDrop = async ( dataTransfer : DataTransfer ) : Promise < void > => {
1903
+ const roomId = this . getRoomId ( ) ;
1904
+ if ( ! roomId || ! this . context . client ) return ;
1905
+ await ContentMessages . sharedInstance ( ) . sendContentListToRoom (
1901
1906
Array . from ( dataTransfer . files ) ,
1902
- this . getRoomId ( ) ,
1903
- null ,
1907
+ roomId ,
1908
+ undefined ,
1904
1909
this . context . client ,
1905
1910
TimelineRenderingType . Room ,
1906
1911
) ;
1912
+ } ;
1907
1913
1908
1914
private onMeasurement = ( narrow : boolean ) : void => {
1909
1915
this . setState ( { narrow } ) ;
0 commit comments