Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into apps…
Browse files Browse the repository at this point in the history
…/removeUsers

* 'develop' of github.com:RocketChat/Rocket.Chat:
  refactor(omnichannel): replace create and find by findAndUpdate (#32773)
  chore: Bump apps engine 1.44-alpha (#32774)
  refactor(client): Remove usage of `React.FC` type (#32760)
  refactor(Livechat): `Livechat/Message/markdown.js` -> TS (#32295)
  refactor(omnichannel): spare few Room.find on requestRoom method (#32363)
  refactor:  `dispatchInquiryPosition` being called multiple times (#32767)
  fix: SAML "Overwrite user fullname" setting is not being honored (#32628)
  fix(Omnichannel): Use Correct components on ChatInfo (#32592)
  • Loading branch information
gabriellsh committed Jul 12, 2024
2 parents 71c7656 + 0a46a11 commit 08e175a
Show file tree
Hide file tree
Showing 206 changed files with 1,049 additions and 718 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-papayas-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed SAML users' full names being updated on login regardless of the "Overwrite user fullname (use idp attribute)" setting
5 changes: 5 additions & 0 deletions .changeset/nervous-rockets-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes Missing line breaks on Omnichannel Room Info Panel
4 changes: 4 additions & 0 deletions apps/meteor/app/apps/server/bridges/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,8 @@ export class AppRoomBridge extends RoomBridge {
): Promise<IMessage[]> {
throw new Error('Method not implemented.');
}

protected removeUsers(_roomId: string, _usernames: Array<string>, _appId: string): Promise<void> {
throw new Error('Method not implemented.');
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Button, Modal } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { FC } from 'react';
import React from 'react';

type PlaceChatOnHoldModalProps = {
Expand All @@ -9,7 +8,7 @@ type PlaceChatOnHoldModalProps = {
onCancel: () => void;
};

const PlaceChatOnHoldModal: FC<PlaceChatOnHoldModalProps> = ({ onCancel, onOnHoldChat, confirm = onOnHoldChat, ...props }) => {
const PlaceChatOnHoldModal = ({ onCancel, onOnHoldChat, confirm = onOnHoldChat, ...props }: PlaceChatOnHoldModalProps) => {
const t = useTranslation();

return (
Expand Down
51 changes: 42 additions & 9 deletions apps/meteor/app/livechat/server/lib/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from '@rocket.chat/models';
import { Match, check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import { ObjectId } from 'mongodb';

import { callbacks } from '../../../../lib/callbacks';
import { validateEmail as validatorFunc } from '../../../../lib/emailValidator';
Expand Down Expand Up @@ -124,13 +125,26 @@ export const createLivechatRoom = async <
...extraRoomInfo,
} as InsertionModel<IOmnichannelRoom>;

const roomId = (await Rooms.insertOne(room)).insertedId;
const result = await Rooms.findOneAndUpdate(
room,
{
$set: {},
},
{
upsert: true,
returnDocument: 'after',
},
);

if (!result.value) {
throw new Error('Room not created');
}

await callbacks.run('livechat.newRoom', room);

await sendMessage(guest, { t: 'livechat-started', msg: '', groupable: false }, room);

return roomId;
return result.value as IOmnichannelRoom;
};

export const createLivechatInquiry = async ({
Expand Down Expand Up @@ -172,8 +186,8 @@ export const createLivechatInquiry = async ({
visitor: { _id, username, department, status, activity },
});

const result = (
await LivechatInquiry.insertOne({
const result = await LivechatInquiry.findOneAndUpdate(
{
rid,
name,
ts,
Expand All @@ -192,11 +206,24 @@ export const createLivechatInquiry = async ({
estimatedWaitingTimeQueue: DEFAULT_SLA_CONFIG.ESTIMATED_WAITING_TIME_QUEUE,

...extraInquiryInfo,
})
).insertedId;
},
{
$set: {
_id: new ObjectId().toHexString(),
},
},
{
upsert: true,
returnDocument: 'after',
},
);
logger.debug(`Inquiry ${result} created for visitor ${_id}`);

return result;
if (!result.value) {
throw new Error('Inquiry not created');
}

return result.value as ILivechatInquiryRecord;
};

export const createLivechatSubscription = async (
Expand Down Expand Up @@ -335,6 +362,10 @@ export const dispatchAgentDelegated = async (rid: string, agentId?: string) => {
});
};

/**
* @deprecated
*/

export const dispatchInquiryQueued = async (inquiry: ILivechatInquiryRecord, agent?: SelectedAgent | null) => {
if (!inquiry?._id) {
return;
Expand All @@ -353,10 +384,12 @@ export const dispatchInquiryQueued = async (inquiry: ILivechatInquiryRecord, age
return;
}

if (!agent || !(await allowAgentSkipQueue(agent))) {
await saveQueueInquiry(inquiry);
if (agent && (await allowAgentSkipQueue(agent))) {
return;
}

await saveQueueInquiry(inquiry);

// Alert only the online agents of the queued request
const onlineAgents = await LivechatTyped.getOnlineAgents(department, agent);
if (!onlineAgents) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/livechat/server/lib/LivechatTyped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class LivechatClass {
return;
}

return Users.findByIds<ILivechatAgent>(agentIds);
return Users.findByIds<ILivechatAgent>([...new Set(agentIds)]);
}
return Users.findOnlineAgents();
}
Expand Down
Loading

0 comments on commit 08e175a

Please sign in to comment.