mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-13 06:12:26 +03:00
Fix message button opens left dm room (#2453)
This commit is contained in:
parent
789da641c1
commit
09b88d164f
1 changed files with 7 additions and 2 deletions
|
@ -17,7 +17,7 @@ import to from 'await-to-js';
|
|||
import { IImageInfo, IThumbnailContent, IVideoInfo } from '../../types/matrix/common';
|
||||
import { AccountDataEvent } from '../../types/matrix/accountData';
|
||||
import { getStateEvent } from './room';
|
||||
import { StateEvent } from '../../types/matrix/room';
|
||||
import { Membership, StateEvent } from '../../types/matrix/room';
|
||||
|
||||
const DOMAIN_REGEX = /\b(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}\b/;
|
||||
|
||||
|
@ -182,7 +182,12 @@ export const eventWithShortcode = (ev: MatrixEvent) =>
|
|||
export const getDMRoomFor = (mx: MatrixClient, userId: string): Room | undefined => {
|
||||
const dmLikeRooms = mx
|
||||
.getRooms()
|
||||
.filter((room) => room.hasEncryptionStateEvent() && room.getMembers().length <= 2);
|
||||
.filter(
|
||||
(room) =>
|
||||
room.getMyMembership() === Membership.Join &&
|
||||
room.hasEncryptionStateEvent() &&
|
||||
room.getMembers().length <= 2
|
||||
);
|
||||
|
||||
return dmLikeRooms.find((room) => room.getMember(userId));
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue