diff --git a/src/matrix/room/BaseRoom.js b/src/matrix/room/BaseRoom.js index 446c22d1..dda3e2e5 100644 --- a/src/matrix/room/BaseRoom.js +++ b/src/matrix/room/BaseRoom.js @@ -421,7 +421,18 @@ export class BaseRoom extends EventEmitter { } isDirectMessageForUserId(userId) { - return this._summary.data.dmUserId === userId; + if (this._summary.data.dmUserId === userId) { + return true; + } else { + // fall back to considering any room a DM containing heroes (e.g. no name) and 2 members, + // on of which the userId we're looking for. + // We need this because we're not yet processing m.direct account data correctly. + const {heroes, joinCount, inviteCount} = this._summary.data; + if (heroes && heroes.includes(userId) && (joinCount + inviteCount) === 2) { + return true; + } + } + return false; } async _loadPowerLevels() {