mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 21:39:22 +00:00
Can cancel a group membership request
This commit is contained in:
parent
8c31a4d8c4
commit
3be2b8d90f
@ -368,6 +368,25 @@ export class GroupsController {
|
|||||||
h.success("The membership has been successfully saved!");
|
h.success("The membership has been successfully saved!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel a membership request
|
||||||
|
*
|
||||||
|
* @param h Request handler
|
||||||
|
*/
|
||||||
|
public static async CancelRequest(h: RequestHandler) {
|
||||||
|
const groupID = await h.postGroupIDWithAccess("id", GroupsAccessLevel.LIMITED_ACCESS);
|
||||||
|
|
||||||
|
if(await GroupsHelper.GetMembershipLevel(groupID, h.getUserId()) != GroupMembershipLevels.PENDING)
|
||||||
|
h.error(401, "You did not send a membership request to this group!");
|
||||||
|
|
||||||
|
// Delete membership of the user
|
||||||
|
await GroupsHelper.DeleteMember(groupID, h.getUserId());
|
||||||
|
|
||||||
|
// TODO : delete any potential notificaton
|
||||||
|
|
||||||
|
h.success("The request has been successfully cancelled!");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn a GroupInfo object into a valid API object
|
* Turn a GroupInfo object into a valid API object
|
||||||
*
|
*
|
||||||
|
@ -112,4 +112,6 @@ export const Routes : Route[] = [
|
|||||||
{path: "/groups/respond_invitation", cb: (h) => GroupsController.RespondInvitation(h)},
|
{path: "/groups/respond_invitation", cb: (h) => GroupsController.RespondInvitation(h)},
|
||||||
|
|
||||||
{path: "/groups/send_request", cb: (h) => GroupsController.SendRequest(h)},
|
{path: "/groups/send_request", cb: (h) => GroupsController.SendRequest(h)},
|
||||||
|
|
||||||
|
{path: "/groups/cancel_request", cb: (h) => GroupsController.CancelRequest(h)},
|
||||||
]
|
]
|
Loading…
Reference in New Issue
Block a user