Skip to content

Conversation

@murtaza98
Copy link
Contributor

@murtaza98 murtaza98 commented Feb 18, 2022

Proposed changes (including videos or screenshots)

Issue(s)

Monitor|Agent can't take the actual chat by pressing the "Take It" button.

Steps to test or reproduce

  1. Click on Omnichannel
  2. Click on Current Chats
  3. Choose one chat that already has an agent
  4. Type the message on the input field to send a message but sometimes a "Take it" button is displayed and can't send any message

Expected Behavior:

Be able to send messages after clicking on the "Take it" button

Actual Behavior:

A warning says "Not permitted" after clicking the button

Further comments

Sidenote from an implementation perspective: In this new PR, we've modified the logic in a way that reverses the changes done here (where this issue was actually introduced) but still fixes the issue in that PR (i.e. Closed chats doesn't show who picked the call) by listening to the "beforeJoinRoom" hook & automatically assign the manager/monitor to the chat, in case no agent is assigned to the chat at that point

@murtaza98 murtaza98 marked this pull request as ready for review February 18, 2022 14:10
@murtaza98 murtaza98 requested a review from a team February 18, 2022 14:10
@murtaza98 murtaza98 added this to the 4.5.0 milestone Feb 18, 2022
@renatobecker renatobecker marked this pull request as draft February 18, 2022 17:42
const inquiry = Template.instance().inquiry.get();
const room = Template.instance().room.get();
return (inquiry && inquiry.status === 'queued') || !room.servedBy;
return inquiry && inquiry.status === 'queued';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gotta say: this works. this won't solve other room-related issues when some room props are updated (like room's name/visibility) but will solve our use case so we should be fine for now.

I'll create a task to address the bigger one.

});
if (!userCanTakeInquiry(user)) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
throw new Meteor.Error('error-not-allowed-due-to-offline', `Not allowed since user's status is offline`, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it true that the only reason for not being able to take the inquiry is because the user is offline? 👀

'cant-join-room',
);

callbacks.add(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this callback needs to be inside a Meteor.startup? Can be on its own ts file and imported on this one? 👀
Additionally, can you add this callback signature to the callback types? (on lib/callbacks.ts)

callbacks.add(
'beforeJoinRoom',
function (user, room) {
if (room.t === 'l' && !room.servedBy) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You can use the isOmnichannelRoom function to check if the room is an omnichannel room.
  2. Change the sense of the if so that if the room is not livechat or the room is already assigned you return the user, so the code can be unnested

@engelgabriel engelgabriel deleted the omni/room-obj-update-1 branch May 2, 2022 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants