Merge pull request #7285 from overleaf/jpa-enforce-edit-own-comment

[misc] block users from editing other users comments

GitOrigin-RevId: 6f2ba38daf8089a478d79ca495b3557a57390b43
This commit is contained in:
Jakob Ackermann
2022-04-05 12:17:56 +00:00
committed by Copybot
parent 99607d4afc
commit b548d4e15b
5 changed files with 103 additions and 20 deletions
@@ -54,11 +54,17 @@ async function deleteThread(req, res) {
}
async function editMessage(req, res) {
const { content } = req.body
const { content, userId } = req.body
const { projectId, threadId, messageId } = req.params
logger.log({ projectId, threadId, messageId, content }, 'editing message')
const room = await ThreadManager.findOrCreateThread(projectId, threadId)
await MessageManager.updateMessage(room._id, messageId, content, Date.now())
await MessageManager.updateMessage(
room._id,
messageId,
userId,
content,
Date.now()
)
res.sendStatus(204)
}