mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-15 02:57:51 +01:00
fix: assertion check to ensure messages are in the room when editing/deleting, etc
This commit is contained in:
@@ -128,7 +128,11 @@ Assert.room = helpers.try(async (req, res, next) => {
|
||||
});
|
||||
|
||||
Assert.message = helpers.try(async (req, res, next) => {
|
||||
if (!isFinite(req.params.mid) || !(await messaging.messageExists(req.params.mid))) {
|
||||
if (
|
||||
!isFinite(req.params.mid) ||
|
||||
!(await messaging.messageExists(req.params.mid)) ||
|
||||
!(await messaging.canViewMessage(req.params.mid, req.params.roomId, req.uid))
|
||||
) {
|
||||
return controllerHelpers.formatApiResponse(400, res, new Error('[[error:invalid-mid]]'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user