Skip to content

Commit

Permalink
Account for encryption in maySendMessage()
Browse files Browse the repository at this point in the history
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
  • Loading branch information
SimonBrandner committed Feb 7, 2022
1 parent 2d23330 commit fb26361
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/models/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2199,8 +2199,9 @@ export class Room extends EventEmitter {
* message events into the room.
*/
public maySendMessage(): boolean {
return this.getMyMembership() === 'join' &&
this.currentState.maySendEvent(EventType.RoomMessage, this.myUserId);
return this.getMyMembership() === 'join' && this.client.isRoomEncrypted(this.roomId)
? this.currentState.maySendEvent(EventType.RoomMessageEncrypted, this.myUserId)
: this.currentState.maySendEvent(EventType.RoomMessage, this.myUserId);
}

/**
Expand Down

0 comments on commit fb26361

Please sign in to comment.