Skip to content

Commit

Permalink
improve: unable to edit the message sent by others (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Himali-Malvawala authored Feb 7, 2025
1 parent 2dde2bd commit e92725d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/MessageController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export class MessageController extends MessagingBaseController {
const promises: Promise<Message>[] = [];
req.body.forEach((message: Message) => {
message.messageType = "message";
if (message?.id && message.personId !== au.personId) {
res.status(403).send("You can not edit the message sent by others.");
return;
}
if (au?.id) {
message.personId = au.personId;
message.displayName = au.firstName + " " + au.lastName;
Expand Down

0 comments on commit e92725d

Please sign in to comment.