mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Fix rights issues
This commit is contained in:
parent
685565e031
commit
07adf8c2ca
@ -10,6 +10,7 @@ import 'package:comunic/ui/dialogs/pick_user_dialog.dart';
|
||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||
import 'package:comunic/utils/account_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -157,7 +158,9 @@ enum _MemberMenuOptions { CHANGE_LEVEL, DELETE }
|
||||
class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
int get groupID => widget.membership.groupID;
|
||||
|
||||
int get userID => widget.membership.userID;
|
||||
int get memberID => widget.membership.userID;
|
||||
|
||||
bool get _isCurrentUser => widget.membership.userID == userID();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -203,7 +206,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
// Change membership level
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Change level")),
|
||||
enabled: widget.group.isAdmin,
|
||||
enabled: !_isCurrentUser && widget.group.isAdmin,
|
||||
value: _MemberMenuOptions.CHANGE_LEVEL,
|
||||
),
|
||||
|
||||
@ -211,6 +214,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Remove")),
|
||||
value: _MemberMenuOptions.DELETE,
|
||||
enabled: !_isCurrentUser,
|
||||
),
|
||||
],
|
||||
onSelected: _handleMenu,
|
||||
@ -240,7 +244,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
|
||||
if (newLevel == null) return;
|
||||
|
||||
await GroupsHelper.setNewLevel(groupID, userID, newLevel);
|
||||
await GroupsHelper.setNewLevel(groupID, memberID, newLevel);
|
||||
} catch (e, s) {
|
||||
print("Could not change group membership level! $e\n$s");
|
||||
showSimpleSnack(context, tr("Could not change group membership level!"));
|
||||
@ -256,7 +260,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
message: tr("Do you really want to remove this membership ?")))
|
||||
return;
|
||||
|
||||
await GroupsHelper.removeMemberFromGroup(groupID, userID);
|
||||
await GroupsHelper.removeMemberFromGroup(groupID, memberID);
|
||||
} catch (e, s) {
|
||||
print("Could not remove membership! $e\n$s");
|
||||
showSimpleSnack(context, tr("Could not remove this membership!"));
|
||||
@ -275,7 +279,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
|
||||
void _cancelMembership() async {
|
||||
try {
|
||||
await GroupsHelper.cancelInvitation(groupID, userID);
|
||||
await GroupsHelper.cancelInvitation(groupID, memberID);
|
||||
} catch (e, s) {
|
||||
print("Could not cancel invitation! $e\n$s");
|
||||
showSimpleSnack(context, tr("Could not cancel invitation!"));
|
||||
@ -304,7 +308,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
|
||||
|
||||
void _respondRequest(bool accept) async {
|
||||
try {
|
||||
await GroupsHelper.respondRequest(groupID, userID, accept);
|
||||
await GroupsHelper.respondRequest(groupID, memberID, accept);
|
||||
} catch (e, s) {
|
||||
print("Could not respond to membership request! $e\n$s");
|
||||
showSimpleSnack(context, tr("Could not respond to membership request!"));
|
||||
|
Loading…
Reference in New Issue
Block a user