This repository was archived by the owner on Oct 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import "./index.css"
1+ import "./index.css" ;
22import RoomItem from "./../RoomItem/" ;
33
44export default function CommunityListItem ( props ) {
5- const { community, community_name } = props ;
6- return (
7- < div className = "community-wrapper" >
8- < div className = "community-title" > { community_name } </ div >
9- { community . map ( ( room ) => {
10- return < RoomItem room = { room } key = { room . rid } > </ RoomItem >
11- } ) }
12- </ div >
13- ) ;
5+ const { community, community_name } = props ;
6+ return (
7+ < div className = "community-wrapper" >
8+ < div className = "community-title" > { community_name } </ div >
9+ { community . map ( ( room ) => {
10+ // Here the second condition holds when new room is created as the response from server doesn't return open field on creation
11+ if ( room . open || room . open === undefined )
12+ return < RoomItem room = { room } key = { room . _id } > </ RoomItem > ;
13+ } ) }
14+ </ div >
15+ ) ;
1416}
Original file line number Diff line number Diff line change @@ -30,10 +30,8 @@ export default function RoomItem({room}) {
3030 < FiUser className = "room-item-type-icon" > </ FiUser >
3131 ) }
3232 < span className = "room-name" >
33- { room . name . split ( / _ ( .+ ) / ) [ 1 ] && room [ "t" ] !== "d"
34- ? room . name . split ( / _ ( .+ ) / ) [ 1 ]
35- : room . name }
36- { room . username ? ` (${ room . username } )` : null }
33+ { ( room . fname && ( room . fname . split ( / _ ( .+ ) / ) [ 1 ] || room . fname ) ) ||
34+ room . name || room . username }
3735 </ span >
3836 </ NavLink >
3937 ) ;
Original file line number Diff line number Diff line change @@ -88,9 +88,7 @@ export default function SignedLeftSidebar(props) {
8888 } ;
8989
9090 useEffect ( ( ) => {
91- const url = `${ rcApiDomain } /api/v1/users.info?userId=${ Cookies . get (
92- "rc_uid"
93- ) } &fields={"userRooms": 1}`;
91+ const url = `${ rcApiDomain } /api/v1/subscriptions.get` ;
9492 fetch ( url , {
9593 headers : {
9694 "X-Auth-Token" : Cookies . get ( "rc_token" ) ,
@@ -101,7 +99,7 @@ export default function SignedLeftSidebar(props) {
10199 } )
102100 . then ( ( response ) => response . json ( ) )
103101 . then ( ( data ) => {
104- setChatRooms ( data . user . rooms ) ;
102+ setChatRooms ( data . update ) ;
105103 } )
106104 . catch ( ( err ) => {
107105 console . log ( "Error Fetching Rooms from server --->" , err ) ;
You can’t perform that action at this time.
0 commit comments