mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Can respond to group membership invitations
This commit is contained in:
@ -73,7 +73,7 @@ class GroupsHelper {
|
||||
// Check which groups information to download
|
||||
final toDownload = Set<int>();
|
||||
groups.forEach((groupID) {
|
||||
if (_groupsListCache.containsKey(groupID))
|
||||
if (!force && _groupsListCache.containsKey(groupID))
|
||||
list[groupID] = _groupsListCache[groupID];
|
||||
else
|
||||
toDownload.add(groupID);
|
||||
@ -101,8 +101,11 @@ class GroupsHelper {
|
||||
.toSet();
|
||||
|
||||
/// Perform a simple membership request
|
||||
Future<bool> _simpleMembershipRequest(int groupID, String uri) async =>
|
||||
(await (APIRequest(uri: uri, needLogin: true)..addInt("id", groupID))
|
||||
Future<bool> _simpleMembershipRequest(int groupID, String uri,
|
||||
{Map<String, String> args}) async =>
|
||||
(await (APIRequest(uri: uri, needLogin: true)
|
||||
..addInt("id", groupID)
|
||||
..addArgs(args == null ? Map() : args))
|
||||
.exec())
|
||||
.isOK;
|
||||
|
||||
@ -118,6 +121,12 @@ class GroupsHelper {
|
||||
Future<bool> sendRequest(int groupID) async =>
|
||||
_simpleMembershipRequest(groupID, "groups/send_request");
|
||||
|
||||
/// Respond to a group membership invitation
|
||||
Future<bool> respondInvitation(int groupID, bool accept) async =>
|
||||
_simpleMembershipRequest(groupID, "groups/respond_invitation", args: {
|
||||
"accept": accept ? "true" : "false",
|
||||
});
|
||||
|
||||
/// Turn an API entry into a group object
|
||||
Group _getGroupFromAPI(Map<String, dynamic> map) {
|
||||
return Group(
|
||||
|
Reference in New Issue
Block a user