forked from mystiq/hydrogen-web
also consider rooms without a name and just you and the other a DM
as we don't process m.direct account data yet
This commit is contained in:
parent
955a6bd6f9
commit
75bbde598d
1 changed files with 12 additions and 1 deletions
|
@ -421,7 +421,18 @@ export class BaseRoom extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
isDirectMessageForUserId(userId) {
|
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() {
|
async _loadPowerLevels() {
|
||||||
|
|
Loading…
Reference in a new issue