Skip to content
Snippets Groups Projects
Unverified Commit 6c2a7ea1 authored by Filipe Marins's avatar Filipe Marins Committed by Diego Sampaio
Browse files

[FIX] room message not load when is a new message (#24955)


* fix: if not find room on subscription try on chatroom

* refactor: remove aditional request and aadd rid

* refactor: remove unsed async

* fields -> projection

* fix link to new users on spotlight

Co-authored-by: default avatarPierre Lehnen <pierre.lehnen@rocket.chat>
parent 043aad43
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,7 @@ export const createDirectRoom = function (members, roomExtraData = {}, options =
);
} else {
const memberIds = members.map((member) => member._id);
const membersWithPreferences = Users.find({ _id: { $in: memberIds } }, { 'username': 1, 'settings.preferences': 1 });
const membersWithPreferences = Users.find({ _id: { $in: memberIds } }, { projection: { 'username': 1, 'settings.preferences': 1 } });
membersWithPreferences.forEach((member) => {
const otherMembers = sortedMembers.filter(({ _id }) => _id !== member._id);
......
......@@ -96,9 +96,9 @@ export const RoomManager = new (function () {
const room = roomCoordinator.getRoomDirectives(type)?.findRoom(name);
RoomHistoryManager.getMoreIfIsEmpty(record.rid);
if (room != null) {
record.rid = room._id;
RoomHistoryManager.getMoreIfIsEmpty(room._id);
if (record.streamActive !== true) {
record.streamActive = true;
msgStream.on(record.rid, async (msg) => {
......@@ -196,10 +196,11 @@ export const RoomManager = new (function () {
Session.set('openedRoom');
}
open(typeName) {
open({ typeName, rid }) {
if (openedRooms[typeName] == null) {
openedRooms[typeName] = {
typeName,
rid,
active: false,
ready: false,
unreadSince: new ReactiveVar(undefined),
......
......@@ -49,7 +49,7 @@ export const openRoom = async function (type, name, render = true) {
return;
}
RoomManager.open(type + name);
RoomManager.open({ typeName: type + name, rid: room._id });
if (render) {
appLayout.renderMainLayout({ center: 'room' });
......
......@@ -11,7 +11,7 @@ const UserItem = ({ item, id, style, t, SideBarItemTemplate, AvatarTemplate, use
<ReactiveUserStatus uid={item._id} />
</Sidebar.Item.Icon>
);
const href = roomCoordinator.getRouteLink(item.t, item);
const href = roomCoordinator.getRouteLink(item.t, { name: item.name });
return (
<SideBarItemTemplate
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment