This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import defaultDispatcher from "../../../dispatcher/dispatcher";
32
32
import dis from "../../../dispatcher/dispatcher" ;
33
33
import {
34
34
shouldShowSpaceInvite ,
35
+ showAddExistingRooms ,
35
36
showCreateNewRoom ,
36
37
showCreateNewSubspace ,
37
38
showSpaceInvite ,
@@ -198,6 +199,7 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
198
199
}
199
200
200
201
const communityId = CommunityPrototypeStore . instance . getSelectedCommunityId ( ) ;
202
+ const canAddRooms = activeSpace ?. currentState ?. maySendStateEvent ( EventType . SpaceChild , cli . getUserId ( ) ) ;
201
203
202
204
let contextMenu : JSX . Element ;
203
205
if ( mainMenuDisplayed ) {
@@ -283,9 +285,11 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
283
285
onClick = { ( e ) => {
284
286
e . preventDefault ( ) ;
285
287
e . stopPropagation ( ) ;
286
- showCreateNewRoom ( activeSpace ) ;
288
+ showAddExistingRooms ( activeSpace ) ;
287
289
closePlusMenu ( ) ;
288
290
} }
291
+ disabled = { ! canAddRooms }
292
+ tooltip = { ! canAddRooms && _t ( "You do not have permissions to add rooms to this space" ) }
289
293
/>
290
294
< IconizedContextMenuOption
291
295
label = { _t ( "Add space" ) }
@@ -296,6 +300,8 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
296
300
showCreateNewSubspace ( activeSpace ) ;
297
301
closePlusMenu ( ) ;
298
302
} }
303
+ disabled = { ! canAddRooms }
304
+ tooltip = { ! canAddRooms && _t ( "You do not have permissions to add spaces to this space" ) }
299
305
>
300
306
< BetaPill />
301
307
</ IconizedContextMenuOption >
Original file line number Diff line number Diff line change 1781
1781
"%(count)s results|one" : " %(count)s result" ,
1782
1782
"Invite" : " Invite" ,
1783
1783
"Add space" : " Add space" ,
1784
+ "You do not have permissions to add spaces to this space" : " You do not have permissions to add spaces to this space" ,
1784
1785
"Join public room" : " Join public room" ,
1785
1786
"Currently joining %(count)s rooms|other" : " Currently joining %(count)s rooms" ,
1786
1787
"Currently joining %(count)s rooms|one" : " Currently joining %(count)s room" ,
You can’t perform that action at this time.
0 commit comments