This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
src/components/views/rooms
test/components/views/rooms Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -58,16 +58,18 @@ const NewRoomIntro = () => {
5858 let body : JSX . Element ;
5959 if ( dmPartner ) {
6060 let introMessage = _t ( "This is the beginning of your direct message history with <displayName/>." ) ;
61- let caption : string ;
61+ let captionElement : JSX . Element = < > </ > ;
6262
6363 if ( isLocalRoom ) {
6464 introMessage = _t ( "Send your first message to invite <displayName/> to chat" ) ;
6565 } else if ( ( room . getJoinedMemberCount ( ) + room . getInvitedMemberCount ( ) ) === 2 ) {
66- caption = _t ( "Only the two of you are in this conversation, unless either of you invites anyone to join." ) ;
66+ captionElement = < p >
67+ { _t ( "Only the two of you are in this conversation, unless either of you invites anyone to join." ) }
68+ </ p > ;
6769 }
6870
6971 const member = room ?. getMember ( dmPartner ) ;
70- const displayName = room . name ;
72+ const displayName = room ? .name || member ?. rawDisplayName || dmPartner ;
7173 body = < React . Fragment >
7274 < RoomAvatar
7375 room = { room }
@@ -87,7 +89,7 @@ const NewRoomIntro = () => {
8789 < p > { _t ( introMessage , { } , {
8890 displayName : ( ) => < b > { displayName } </ b > ,
8991 } ) } </ p >
90- { caption && < p > { caption } </ p > }
92+ { captionElement }
9193 </ React . Fragment > ;
9294 } else {
9395 const inRoom = room && room . getMyMembership ( ) === "join" ;
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ describe("NewRoomIntro", () => {
6060
6161 it ( "should render the expected intro" , ( ) => {
6262 const expected = `This is the beginning of your direct message history with test_room.` ;
63- screen . getByText ( ( id , element ) => element . tagName === "SPAN" && element . textContent === expected ) ;
63+ screen . getByText ( ( id , element ) => element ? .tagName === "SPAN" && element ? .textContent === expected ) ;
6464 } ) ;
6565 } ) ;
6666
@@ -75,7 +75,7 @@ describe("NewRoomIntro", () => {
7575
7676 it ( "should render the expected intro" , ( ) => {
7777 const expected = `Send your first message to invite test_room to chat` ;
78- screen . getByText ( ( id , element ) => element . tagName === "SPAN" && element . textContent === expected ) ;
78+ screen . getByText ( ( id , element ) => element ? .tagName === "SPAN" && element ? .textContent === expected ) ;
7979 } ) ;
8080 } ) ;
8181} ) ;
You can’t perform that action at this time.
0 commit comments