Should open new 1:1 chat room after leaving the old one (#9880)
* should open new 1:1 chat room after leaving the old one Signed-off-by: Ahmad Kadri <ahmad.kadri@nordeck.net> * change the copyright * update the test Signed-off-by: AHMAD KADRI <52747422+ahmadkadri@users.noreply.github.com> --------- Signed-off-by: Ahmad Kadri <ahmad.kadri@nordeck.net> Signed-off-by: AHMAD KADRI <52747422+ahmadkadri@users.noreply.github.com> Co-authored-by: Oliver Sand <oliver.sand@nordeck.net> Co-authored-by: Dominik Henneke <dominik.henneke@nordeck.net>
This commit is contained in:
parent
a8aa4de4b4
commit
c7b01af49e
2 changed files with 65 additions and 4 deletions
|
@ -138,6 +138,7 @@ import { cleanUpBroadcasts, VoiceBroadcastResumer } from "../../voice-broadcast"
|
|||
import GenericToast from "../views/toasts/GenericToast";
|
||||
import { Linkify } from "../views/elements/Linkify";
|
||||
import RovingSpotlightDialog, { Filter } from "../views/dialogs/spotlight/SpotlightDialog";
|
||||
import { findDMForUser } from "../../utils/dm/findDMForUser";
|
||||
|
||||
// legacy export
|
||||
export { default as Views } from "../../Views";
|
||||
|
@ -1101,13 +1102,12 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
// TODO: Immutable DMs replaces this
|
||||
|
||||
const client = MatrixClientPeg.get();
|
||||
const dmRoomMap = new DMRoomMap(client);
|
||||
const dmRooms = dmRoomMap.getDMRoomsForUserId(userId);
|
||||
const dmRoom = findDMForUser(client, userId);
|
||||
|
||||
if (dmRooms.length > 0) {
|
||||
if (dmRoom) {
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: dmRooms[0],
|
||||
room_id: dmRoom.roomId,
|
||||
metricsTrigger: "MessageUser",
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue