diff --git a/app/e2e/client/rocketchat.e2e.js b/app/e2e/client/rocketchat.e2e.js index 74d52a129f0d..2c0541350ec5 100644 --- a/app/e2e/client/rocketchat.e2e.js +++ b/app/e2e/client/rocketchat.e2e.js @@ -25,7 +25,7 @@ import { call } from '../../ui-utils'; import './events.js'; import './tabbar'; import { log, logError } from './logger'; -import { waitUntilFind } from './waitUntilFind'; +import { waitUntilFind } from '../../utils/client/lib/waitUntilFind'; import { imperativeModal } from '../../../client/lib/imperativeModal'; import SaveE2EPasswordModal from './SaveE2EPasswordModal'; import EnterE2EPasswordModal from './EnterE2EPasswordModal'; diff --git a/app/ui-utils/client/lib/openRoom.js b/app/ui-utils/client/lib/openRoom.js index 30a8e7f20cb6..7d4261f7c29a 100644 --- a/app/ui-utils/client/lib/openRoom.js +++ b/app/ui-utils/client/lib/openRoom.js @@ -19,18 +19,6 @@ window.currentTracker = undefined; // cleanup session when hot reloading Session.set('openedRoom', null); - -export const waitUntilRoomBeInserted = async (type, rid) => new Promise((resolve) => { - Tracker.autorun((c) => { - const room = roomTypes.findRoom(type, rid, Meteor.user()); - if (room) { - c.stop(); - return resolve(room); - } - }); -}); - - NewRoomManager.on('changed', (rid) => { Session.set('openedRoom', rid); RoomManager.openedRoom = rid; diff --git a/app/utils/client/index.js b/app/utils/client/index.js index 6df40269d05e..4ada524ca0b6 100644 --- a/app/utils/client/index.js +++ b/app/utils/client/index.js @@ -19,3 +19,4 @@ export { templateVarHandler } from '../lib/templateVarHandler'; export { APIClient, mountArrayQueryParameters } from './lib/RestApiClient'; export { canDeleteMessage } from './lib/canDeleteMessage'; export { secondsToHHMMSS } from '../lib/timeConverter'; +export { waitUntilFind } from './lib/waitUntilFind'; diff --git a/app/e2e/client/waitUntilFind.ts b/app/utils/client/lib/waitUntilFind.ts similarity index 100% rename from app/e2e/client/waitUntilFind.ts rename to app/utils/client/lib/waitUntilFind.ts diff --git a/client/lib/goToRoomById.ts b/client/lib/goToRoomById.ts index b80c2222fe54..1be5bd2ce671 100644 --- a/client/lib/goToRoomById.ts +++ b/client/lib/goToRoomById.ts @@ -12,12 +12,14 @@ export const goToRoomById = async (rid: IRoom['_id']): Promise => { if (!rid) { return; } + const subscription = ChatSubscription.findOne({ rid }); + if (subscription) { roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams); return; } const room = await getRoomById(rid); - roomTypes.openRouteLink(room.t, room, FlowRouter.current().queryParams); + roomTypes.openRouteLink(room.t, { rid: room._id, ...room }, FlowRouter.current().queryParams); }; diff --git a/client/startup/e2e.ts b/client/startup/e2e.ts index bc5b74c668a9..c4db9afe62ca 100644 --- a/client/startup/e2e.ts +++ b/client/startup/e2e.ts @@ -3,12 +3,12 @@ import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; import { e2e } from '../../app/e2e/client/rocketchat.e2e'; -import { waitUntilFind } from '../../app/e2e/client/waitUntilFind'; import { Subscriptions, Rooms } from '../../app/models/client'; import { Notifications } from '../../app/notifications/client'; import { promises } from '../../app/promises/client'; import { settings } from '../../app/settings/client'; import { Layout } from '../../app/ui-utils/client'; +import { waitUntilFind } from '../../app/utils/client'; import { IMessage } from '../../definition/IMessage'; import { IRoom } from '../../definition/IRoom'; import { ISubscription } from '../../definition/ISubscription'; diff --git a/client/views/room/contextualBar/RoomMembers/List/RoomMembers.js b/client/views/room/contextualBar/RoomMembers/List/RoomMembers.js index d769791a7a42..a5dbc7f0b74a 100644 --- a/client/views/room/contextualBar/RoomMembers/List/RoomMembers.js +++ b/client/views/room/contextualBar/RoomMembers/List/RoomMembers.js @@ -35,6 +35,7 @@ const RoomMembers = ({ renderRow: Row = DefaultRow, rid, isTeam, + isDirect, reload, }) => { const t = useTranslation(); @@ -130,7 +131,7 @@ const RoomMembers = ({ )} - {(onClickInvite || onClickAdd) && ( + {!isDirect && (onClickInvite || onClickAdd) && ( {onClickInvite && ( diff --git a/client/views/room/contextualBar/RoomMembers/List/RoomMembersWithData.js b/client/views/room/contextualBar/RoomMembers/List/RoomMembersWithData.js index 4a2ca2ed5572..0558b4f54064 100644 --- a/client/views/room/contextualBar/RoomMembers/List/RoomMembersWithData.js +++ b/client/views/room/contextualBar/RoomMembers/List/RoomMembersWithData.js @@ -21,6 +21,7 @@ const RoomMembersWithData = ({ rid }) => { const onClickClose = useTabBarClose(); const room = useUserRoom(rid); const isTeam = room.teamMain; + const isDirect = room.t === 'd'; room.type = room.t; room.rid = rid; @@ -100,6 +101,7 @@ const RoomMembersWithData = ({ rid }) => {