feat: Add connection validation before sending messages and extend support chat admin access to include SUPER_ADMIN role.
This commit is contained in:
@@ -191,6 +191,17 @@ export class MessagesService {
|
||||
throw new ForbiddenException('You are not part of this conversation');
|
||||
}
|
||||
|
||||
// Verify connection is still active before allowing message
|
||||
const canMessage = await this.validateCanMessage(
|
||||
conversation.userId,
|
||||
conversation.agentProfileId,
|
||||
);
|
||||
if (!canMessage) {
|
||||
throw new ForbiddenException(
|
||||
'You can only message users with accepted connection requests',
|
||||
);
|
||||
}
|
||||
|
||||
// Create the message
|
||||
const message = await this.prisma.message.create({
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user