Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/controllers/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const addComment = async (req, res, next) => {
export const deleteComment = async (req, res, next) => {
try {
const comment = await Comment.findById(res.params.id);
const video = await Video.findById(res.params.id);
const video = await Video.findById(comment.videoId);
if (req.user.id === comment.userId || req.user.id === video.userId) {
await Comment.findByIdAndDelete(req.params.id);
res.status(200).json("The comment has been deleted.");
Expand Down