mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Can invite a user to join a group
This commit is contained in:
parent
2ec8693e85
commit
3c7795837c
@ -268,6 +268,15 @@ class GroupsHelper {
|
||||
.map((f) => _apiToGroupMembership(f))
|
||||
.toList());
|
||||
|
||||
/// Invite a user to join a group
|
||||
///
|
||||
/// Throws an exception in case of failure
|
||||
static Future<void> sendInvitation(int groupID, int userID) async =>
|
||||
APIRequest.withLogin("groups/invite")
|
||||
.addInt("group_id", groupID)
|
||||
.addInt("userID", userID)
|
||||
.execWithThrow();
|
||||
|
||||
/// Cancel a group membership invitation
|
||||
///
|
||||
/// Throws an exception in case of failure
|
||||
|
@ -96,11 +96,13 @@ class _GroupMembersScreenState extends State<GroupMembersScreen> {
|
||||
final userID = await showPickUserDialog(context);
|
||||
if (userID == null) return;
|
||||
|
||||
print("Invite user: $userID");
|
||||
await GroupsHelper.sendInvitation(widget.groupID, userID);
|
||||
} catch (e, s) {
|
||||
print("Could not invite a user! $e\n$s");
|
||||
showSimpleSnack(context, tr("Could not invite a user!"));
|
||||
}
|
||||
|
||||
_key.currentState.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user