mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Can cancel invitation
This commit is contained in:
parent
38d3f4de8d
commit
56f92173f2
@ -3,6 +3,7 @@ import 'package:comunic/helpers/groups_helper.dart';
|
|||||||
import 'package:comunic/helpers/users_helper.dart';
|
import 'package:comunic/helpers/users_helper.dart';
|
||||||
import 'package:comunic/lists/group_members_list.dart';
|
import 'package:comunic/lists/group_members_list.dart';
|
||||||
import 'package:comunic/lists/users_list.dart';
|
import 'package:comunic/lists/users_list.dart';
|
||||||
|
import 'package:comunic/models/group.dart';
|
||||||
import 'package:comunic/models/group_membership.dart';
|
import 'package:comunic/models/group_membership.dart';
|
||||||
import 'package:comunic/models/user.dart';
|
import 'package:comunic/models/user.dart';
|
||||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||||
@ -10,13 +11,15 @@ import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
|||||||
import 'package:comunic/utils/account_utils.dart';
|
import 'package:comunic/utils/account_utils.dart';
|
||||||
import 'package:comunic/utils/conversations_utils.dart';
|
import 'package:comunic/utils/conversations_utils.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:comunic/utils/log_utils.dart';
|
||||||
|
import 'package:comunic/utils/ui_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// Forez directory screen
|
/// Forez directory screen
|
||||||
///
|
///
|
||||||
/// @author Pierre Hubert
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
enum _PopupMenuActions { PRIVATE_CONVERSATION }
|
enum _PopupMenuActions { PRIVATE_CONVERSATION, CANCEL_INVITATION }
|
||||||
|
|
||||||
class ForezDirectoryScreen extends StatefulWidget {
|
class ForezDirectoryScreen extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@ -52,10 +55,20 @@ class _ForezDirectoryScreenState extends State<ForezDirectoryScreen> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
void _doPopupMenuAction(_PopupMenuActions action, User user) async {
|
void _doPopupMenuAction(_PopupMenuActions action, User user) async {
|
||||||
switch (action) {
|
try {
|
||||||
case _PopupMenuActions.PRIVATE_CONVERSATION:
|
switch (action) {
|
||||||
openPrivateConversation(context, user.id);
|
case _PopupMenuActions.PRIVATE_CONVERSATION:
|
||||||
break;
|
openPrivateConversation(context, user.id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case _PopupMenuActions.CANCEL_INVITATION:
|
||||||
|
await GroupsHelper.cancelInvitation(forezGroup.id, user.id);
|
||||||
|
_key.currentState.refresh();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
logError(e, s);
|
||||||
|
snack(context, tr("Error while processing action!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,6 +102,14 @@ class _ForezMemberTile extends StatelessWidget {
|
|||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Text(tr("Private conversation")),
|
child: Text(tr("Private conversation")),
|
||||||
value: _PopupMenuActions.PRIVATE_CONVERSATION,
|
value: _PopupMenuActions.PRIVATE_CONVERSATION,
|
||||||
),
|
)
|
||||||
];
|
]..addAll(member.level == GroupMembershipLevel.INVITED &&
|
||||||
|
forezGroup.isAtLeastModerator
|
||||||
|
? [
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Text(tr("Cancel invitation")),
|
||||||
|
value: _PopupMenuActions.CANCEL_INVITATION,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: []);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user