1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 16:45:16 +00:00

Can update following status of a frienship

This commit is contained in:
2020-01-01 14:58:31 +01:00
parent f46d87def5
commit 4cfb85d1ad
4 changed files with 52 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import { UserHelper } from "../helpers/UserHelper";
import { GroupsAccessLevel } from "./Group";
import { GroupsHelper } from "../helpers/GroupsHelper";
import { checkVirtualDirectory } from "../utils/VirtualDirsUtils";
import { FriendsHelper } from "../helpers/FriendsHelper";
/**
* Response to a request
@ -209,6 +210,20 @@ export class RequestHandler {
return userID;
}
/**
* Get the ID of a friend included in a POST request
*
* @param name Name of the POST field
*/
public async postFriendId(name: string) : Promise<number> {
const friendID = await this.postUserId(name);
if(!await FriendsHelper.AreFriend(this.getUserId(), friendID))
this.error(401, "You are not friend with this personn!");
return friendID;
}
/**
* Find user ID based on its email address, included in a POST request
*