mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 16:45:16 +00:00
Can get the list of post targets of a user
This commit is contained in:
@ -18,6 +18,7 @@ import { pathUserData } from "../utils/UserDataUtils";
|
||||
import { statSync } from "fs";
|
||||
import { lookup } from "mime-types";
|
||||
import { NewSurvey } from "../entities/NewSurvey";
|
||||
import { FriendsHelper } from "../helpers/FriendsHelper";
|
||||
|
||||
/**
|
||||
* Posts controller
|
||||
@ -349,6 +350,21 @@ export class PostsController {
|
||||
h.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lists of targets where the current user can create posts
|
||||
*
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async GetTargets(h: RequestHandler) {
|
||||
const friends = await FriendsHelper.GetListThatAllowsPostsFromUser(h.getUserId());
|
||||
const groups = await GroupsHelper.GetListUserWhereCanCreatePosts(h.getUserId());
|
||||
|
||||
h.send({
|
||||
friends: friends,
|
||||
groups: groups
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send multiple posts to the API
|
||||
*
|
||||
|
@ -200,6 +200,8 @@ export const Routes : Route[] = [
|
||||
|
||||
{path: "/posts/delete", cb: (h) => PostsController.DeletePost(h)},
|
||||
|
||||
{path: "/posts/getAvailableTargets", cb: (h) => PostsController.GetTargets(h)},
|
||||
|
||||
|
||||
|
||||
// Notifications controller
|
||||
|
Reference in New Issue
Block a user