mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +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 { NotifEventType } from "../entities/Notification";
|
||||||
import { NotificationsHelper } from "../helpers/NotificationsHelper";
|
import { NotificationsHelper } from "../helpers/NotificationsHelper";
|
||||||
import { AbstractUserConnectionContainer } from "../entities/UserConnectionContainer";
|
import { AbstractUserConnectionContainer } from "../entities/UserConnectionContainer";
|
||||||
|
import { PostsHelper } from "../helpers/PostsHelper";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comments controller
|
* Comments controller
|
||||||
@ -24,6 +25,11 @@ export class CommentsController {
|
|||||||
public static async Create(h: RequestHandler) {
|
public static async Create(h: RequestHandler) {
|
||||||
const postID = await h.postPostIDWithAccess("postID");
|
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;
|
let content: string, image_path: string;
|
||||||
|
|
||||||
// Check if an image was included in the request or not
|
// Check if an image was included in the request or not
|
||||||
|
Loading…
Reference in New Issue
Block a user