@@ -46,6 +46,7 @@ import { shouldShowComponent } from "../../../customisations/helpers/UIComponent
46
46
import { UIComponent } from "../../../settings/UIFeature" ;
47
47
import PosthogTrackers from "../../../PosthogTrackers" ;
48
48
import { SDKContext } from "../../../contexts/SDKContext" ;
49
+ import AccessibleTooltipButton from "../elements/AccessibleTooltipButton" ;
49
50
50
51
const INITIAL_LOAD_NUM_MEMBERS = 30 ;
51
52
const INITIAL_LOAD_NUM_INVITED = 5 ;
@@ -349,23 +350,32 @@ export default class MemberList extends React.Component<IProps, IState> {
349
350
350
351
const cli = MatrixClientPeg . get ( ) ;
351
352
const room = cli . getRoom ( this . props . roomId ) ;
352
- let inviteButton ;
353
+ let inviteButton : JSX . Element | undefined ;
353
354
354
355
if ( room ?. getMyMembership ( ) === "join" && shouldShowComponent ( UIComponent . InviteUsers ) ) {
355
356
let inviteButtonText = _t ( "Invite to this room" ) ;
356
357
if ( room . isSpaceRoom ( ) ) {
357
358
inviteButtonText = _t ( "Invite to this space" ) ;
358
359
}
359
360
360
- inviteButton = (
361
- < AccessibleButton
362
- className = "mx_MemberList_invite"
363
- onClick = { this . onInviteButtonClick }
364
- disabled = { ! this . state . canInvite }
365
- >
366
- < span > { inviteButtonText } </ span >
367
- </ AccessibleButton >
368
- ) ;
361
+ if ( this . state . canInvite ) {
362
+ inviteButton = (
363
+ < AccessibleButton className = "mx_MemberList_invite" onClick = { this . onInviteButtonClick } >
364
+ < span > { inviteButtonText } </ span >
365
+ </ AccessibleButton >
366
+ ) ;
367
+ } else {
368
+ inviteButton = (
369
+ < AccessibleTooltipButton
370
+ className = "mx_MemberList_invite"
371
+ onClick = { null }
372
+ disabled
373
+ tooltip = { _t ( "You do not have permission to invite users" ) }
374
+ >
375
+ < span > { inviteButtonText } </ span >
376
+ </ AccessibleTooltipButton >
377
+ ) ;
378
+ }
369
379
}
370
380
371
381
let invitedHeader ;
0 commit comments