@@ -24,7 +24,7 @@ import sdk from 'matrix-react-sdk';
2424import dis from 'matrix-react-sdk/lib/dispatcher' ;
2525import { MatrixClient } from 'matrix-js-sdk' ;
2626import Analytics from 'matrix-react-sdk/lib/Analytics' ;
27- import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc' ;
27+ import RateLimitedFunc from 'matrix-react-sdk/lib/ratelimitedfunc' ;
2828import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton' ;
2929import { showGroupInviteDialog , showGroupAddRoomDialog } from 'matrix-react-sdk/lib/GroupAddressPicker' ;
3030import GroupStoreCache from 'matrix-react-sdk/lib/stores/GroupStoreCache' ;
@@ -58,8 +58,8 @@ class HeaderButton extends React.Component {
5858 < div className = "mx_RightPanel_headerButton_badge" >
5959 { this . props . badge ? this . props . badge : < span > </ span > }
6060 </ div >
61- < TintableSvg src = { this . props . iconSrc } width = "25" height = "25" />
62- { this . props . isHighlighted ? < div className = "mx_RightPanel_headerButton_highlight" > </ div > : < div /> }
61+ < TintableSvg src = { this . props . iconSrc } width = "25" height = "25" />
62+ { this . props . isHighlighted ? < div className = "mx_RightPanel_headerButton_highlight" / > : < div /> }
6363
6464 </ AccessibleButton > ;
6565 }
@@ -184,18 +184,17 @@ module.exports = React.createClass({
184184
185185 onRoomStateMember : function ( ev , state , member ) {
186186 // redraw the badge on the membership list
187- if ( this . state . phase == this . Phase . RoomMemberList && member . roomId === this . props . roomId ) {
187+ if ( this . state . phase === this . Phase . RoomMemberList && member . roomId === this . props . roomId ) {
188188 this . _delayedUpdate ( ) ;
189- }
190- else if ( this . state . phase === this . Phase . RoomMemberInfo && member . roomId === this . props . roomId &&
189+ } else if ( this . state . phase === this . Phase . RoomMemberInfo && member . roomId === this . props . roomId &&
191190 member . userId === this . state . member . userId ) {
192191 // refresh the member info (e.g. new power level)
193192 this . _delayedUpdate ( ) ;
194193 }
195194 } ,
196195
197- _delayedUpdate : new rate_limited_func ( function ( ) {
198- this . forceUpdate ( ) ;
196+ _delayedUpdate : new RateLimitedFunc ( function ( ) {
197+ this . forceUpdate ( ) ; // eslint-disable-line babel/no-invalid-this
199198 } , 500 ) ,
200199
201200 onAction : function ( payload ) {
@@ -266,22 +265,23 @@ module.exports = React.createClass({
266265 let inviteGroup ;
267266
268267 let membersBadge ;
269- if ( ( this . state . phase == this . Phase . RoomMemberList || this . state . phase === this . Phase . RoomMemberInfo )
268+ let membersTitle = _t ( 'Members' ) ;
269+ if ( ( this . state . phase === this . Phase . RoomMemberList || this . state . phase === this . Phase . RoomMemberInfo )
270270 && this . props . roomId
271271 ) {
272272 const cli = this . context . matrixClient ;
273273 const room = cli . getRoom ( this . props . roomId ) ;
274- let userIsInRoom ;
274+ let isUserInRoom ;
275275 if ( room ) {
276- membersBadge = formatCount ( room . getJoinedMembers ( ) . length ) ;
277- userIsInRoom = room . hasMembershipState (
278- this . context . matrixClient . credentials . userId , 'join' ,
279- ) ;
276+ const numMembers = room . getJoinedMembers ( ) . length ;
277+ membersTitle = _t ( '%(count)s Members' , { count : numMembers } ) ;
278+ membersBadge = < div title = { membersTitle } > { formatCount ( numMembers ) } </ div > ;
279+ isUserInRoom = room . hasMembershipState ( this . context . matrixClient . credentials . userId , 'join' ) ;
280280 }
281281
282- if ( userIsInRoom ) {
282+ if ( isUserInRoom ) {
283283 inviteGroup =
284- < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
284+ < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
285285 < div className = "mx_RightPanel_icon" >
286286 < TintableSvg src = "img/icon-invite-people.svg" width = "35" height = "35" />
287287 </ div >
@@ -292,13 +292,13 @@ module.exports = React.createClass({
292292
293293 const isPhaseGroup = [
294294 this . Phase . GroupMemberInfo ,
295- this . Phase . GroupMemberList
295+ this . Phase . GroupMemberList ,
296296 ] . includes ( this . state . phase ) ;
297297
298298 let headerButtons = [ ] ;
299299 if ( this . props . roomId ) {
300300 headerButtons = [
301- < HeaderButton key = "_membersButton" title = { _t ( 'Members' ) } iconSrc = "img/icons-people.svg"
301+ < HeaderButton key = "_membersButton" title = { membersTitle } iconSrc = "img/icons-people.svg"
302302 isHighlighted = { [ this . Phase . RoomMemberList , this . Phase . RoomMemberInfo ] . includes ( this . state . phase ) }
303303 clickPhase = { this . Phase . RoomMemberList }
304304 badge = { membersBadge }
@@ -336,54 +336,54 @@ module.exports = React.createClass({
336336 // button on these 2 screens or you won't be able to re-expand the panel.
337337 headerButtons . push (
338338 < div className = "mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key = "_minimizeButton"
339- title = { _t ( "Hide panel" ) } aria-label = { _t ( "Hide panel" ) } onClick = { this . onCollapseClick }
339+ title = { _t ( "Hide panel" ) } aria-label = { _t ( "Hide panel" ) } onClick = { this . onCollapseClick }
340340 >
341- < TintableSvg src = "img/minimise.svg" width = "10" height = "16" />
341+ < TintableSvg src = "img/minimise.svg" width = "10" height = "16" />
342342 </ div > ,
343343 ) ;
344344 }
345345
346346 let panel = < div /> ;
347347 if ( ! this . props . collapsed ) {
348- if ( this . props . roomId && this . state . phase == this . Phase . RoomMemberList ) {
348+ if ( this . props . roomId && this . state . phase === this . Phase . RoomMemberList ) {
349349 panel = < MemberList roomId = { this . props . roomId } key = { this . props . roomId } /> ;
350- } else if ( this . props . groupId && this . state . phase == this . Phase . GroupMemberList ) {
350+ } else if ( this . props . groupId && this . state . phase === this . Phase . GroupMemberList ) {
351351 panel = < GroupMemberList groupId = { this . props . groupId } key = { this . props . groupId } /> ;
352352 } else if ( this . state . phase === this . Phase . GroupRoomList ) {
353353 panel = < GroupRoomList groupId = { this . props . groupId } key = { this . props . groupId } /> ;
354- } else if ( this . state . phase == this . Phase . RoomMemberInfo ) {
354+ } else if ( this . state . phase === this . Phase . RoomMemberInfo ) {
355355 panel = < MemberInfo member = { this . state . member } key = { this . props . roomId || this . state . member . userId } /> ;
356- } else if ( this . state . phase == this . Phase . GroupMemberInfo ) {
356+ } else if ( this . state . phase === this . Phase . GroupMemberInfo ) {
357357 panel = < GroupMemberInfo
358358 groupMember = { this . state . member }
359359 groupId = { this . props . groupId }
360360 key = { this . state . member . user_id } /> ;
361- } else if ( this . state . phase == this . Phase . GroupRoomInfo ) {
361+ } else if ( this . state . phase === this . Phase . GroupRoomInfo ) {
362362 panel = < GroupRoomInfo
363363 groupRoomId = { this . state . groupRoomId }
364364 groupId = { this . props . groupId }
365365 key = { this . state . groupRoomId } /> ;
366- } else if ( this . state . phase == this . Phase . NotificationPanel ) {
366+ } else if ( this . state . phase === this . Phase . NotificationPanel ) {
367367 panel = < NotificationPanel /> ;
368- } else if ( this . state . phase == this . Phase . FilePanel ) {
368+ } else if ( this . state . phase === this . Phase . FilePanel ) {
369369 panel = < FilePanel roomId = { this . props . roomId } /> ;
370370 }
371371 }
372372
373373 if ( ! panel ) {
374- panel = < div className = "mx_RightPanel_blank" > </ div > ;
374+ panel = < div className = "mx_RightPanel_blank" / >;
375375 }
376376
377377 if ( this . props . groupId && this . state . isUserPrivilegedInGroup ) {
378378 inviteGroup = isPhaseGroup ? (
379- < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
379+ < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
380380 < div className = "mx_RightPanel_icon" >
381381 < TintableSvg src = "img/icon-invite-people.svg" width = "35" height = "35" />
382382 </ div >
383383 < div className = "mx_RightPanel_message" > { _t ( 'Invite to this community' ) } </ div >
384384 </ AccessibleButton >
385385 ) : (
386- < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
386+ < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
387387 < div className = "mx_RightPanel_icon" >
388388 < TintableSvg src = "img/icons-room-add.svg" width = "35" height = "35" />
389389 </ div >
@@ -392,19 +392,16 @@ module.exports = React.createClass({
392392 ) ;
393393 }
394394
395- let classes = classNames (
396- "mx_RightPanel" , "mx_fadable" ,
397- {
398- "collapsed" : this . props . collapsed ,
399- "mx_fadable_faded" : this . props . disabled ,
400- }
401- ) ;
395+ const classes = classNames ( "mx_RightPanel" , "mx_fadable" , {
396+ "collapsed" : this . props . collapsed ,
397+ "mx_fadable_faded" : this . props . disabled ,
398+ } ) ;
402399
403400 return (
404401 < aside className = { classes } >
405402 < div className = "mx_RightPanel_header" >
406403 < div className = "mx_RightPanel_headerButtonGroup" >
407- { headerButtons }
404+ { headerButtons }
408405 </ div >
409406 </ div >
410407 { panel }
0 commit comments