mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(issues): only allow edit of own comments & do not allow non-admin delete of issues with comments (#2248)
This commit is contained in:
@@ -302,7 +302,7 @@ issueRoutes.delete('/:issueId', async (req, res, next) => {
|
||||
|
||||
if (
|
||||
!req.user?.hasPermission(Permission.MANAGE_ISSUES) &&
|
||||
issue.createdBy.id !== req.user?.id
|
||||
(issue.createdBy.id !== req.user?.id || issue.comments.length > 1)
|
||||
) {
|
||||
return next({
|
||||
status: 401,
|
||||
|
@@ -68,13 +68,10 @@ issueCommentRoutes.put<
|
||||
where: { id: Number(req.params.commentId) },
|
||||
});
|
||||
|
||||
if (
|
||||
!req.user?.hasPermission([Permission.MANAGE_ISSUES], { type: 'or' }) &&
|
||||
comment.user.id !== req.user?.id
|
||||
) {
|
||||
if (comment.user.id !== req.user?.id) {
|
||||
return next({
|
||||
status: 403,
|
||||
message: 'You do not have permission to edit this comment.',
|
||||
message: 'You can only edit your own comments.',
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user