mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-12-25 13:08:51 +00:00
Add a check
This commit is contained in:
parent
c9646f8b30
commit
63953587f8
@ -7,6 +7,7 @@ import { CommentsHelper } from "../helpers/CommentsHelper";
|
||||
import { NotifEventType } from "../entities/Notification";
|
||||
import { NotificationsHelper } from "../helpers/NotificationsHelper";
|
||||
import { AbstractUserConnectionContainer } from "../entities/UserConnectionContainer";
|
||||
import { PostsHelper } from "../helpers/PostsHelper";
|
||||
|
||||
/**
|
||||
* Comments controller
|
||||
@ -24,6 +25,11 @@ export class CommentsController {
|
||||
public static async Create(h: RequestHandler) {
|
||||
const postID = await h.postPostIDWithAccess("postID");
|
||||
|
||||
// Check if the post allows comments
|
||||
if(!await PostsHelper.AllowCommentsOnPost(await PostsHelper.GetSingle(postID))) {
|
||||
h.error(401, "You can not create comments on this post!");
|
||||
}
|
||||
|
||||
let content: string, image_path: string;
|
||||
|
||||
// Check if an image was included in the request or not
|
||||
|
Loading…
Reference in New Issue
Block a user