Merge pull request #224 from pangeachat/only-admins-toggle-spaces
Only admins toggle spaces
This commit is contained in:
commit
46a71d46d8
3 changed files with 16 additions and 4 deletions
|
|
@ -30,7 +30,9 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
|||
void _onPressed(BuildContext context) async {
|
||||
//#Pangea
|
||||
if (controller.activeSpaceId != null) {
|
||||
context.go('/rooms/newgroup?spaceId=${controller.activeSpaceId ?? ''}');
|
||||
context.go(
|
||||
'/rooms/newgroup${controller.activeSpaceId != null ? '?spaceId=${controller.activeSpaceId}' : ''}',
|
||||
);
|
||||
return;
|
||||
}
|
||||
//Pangea#
|
||||
|
|
@ -44,7 +46,9 @@ class StartChatFloatingActionButton extends StatelessWidget {
|
|||
case ActiveFilter.groups:
|
||||
// #Pangea
|
||||
// context.go('/rooms/newgroup');
|
||||
context.go('/rooms/newgroup?spaceId=${controller.activeSpaceId ?? ''}');
|
||||
context.go(
|
||||
'/rooms/newgroup${controller.activeSpaceId != null ? '?spaceId=${controller.activeSpaceId}' : ''}',
|
||||
);
|
||||
// Pangea#
|
||||
break;
|
||||
case ActiveFilter.spaces:
|
||||
|
|
|
|||
|
|
@ -815,6 +815,9 @@ extension PangeaRoom on Room {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
if (room != null && !room.isRoomAdmin) {
|
||||
return false;
|
||||
}
|
||||
if (!pangeaCanSendEvent(EventTypes.spaceChild) && !isRoomAdmin) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,8 +235,13 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
),
|
||||
activeColor: AppConfig.activeToggleColor,
|
||||
value: isSuggestedInSpace(possibleParent),
|
||||
onChanged: (bool suggest) =>
|
||||
setSuggested(suggest, possibleParent),
|
||||
onChanged: (bool suggest) => canAdd
|
||||
? setSuggested(suggest, possibleParent)
|
||||
: ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(L10n.of(context)!.noPermission),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue