-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Close omnichannel conversations when agent is deactivated (#22917)
* close omnichannel conversations when agent is deactivated * Remove console.log * remove unnecesary props from type * Update app/lib/server/functions/setUserActiveStatus.js Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com> Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com> Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com>
- Loading branch information
1 parent
d4ce52e
commit 00f82fe
Showing
5 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { TAPi18n } from 'meteor/rocketchat:tap-i18n'; | ||
|
||
import { LivechatRooms } from '../../../models/server'; | ||
import { IUser } from '../../../../definition/IUser'; | ||
import { settings } from '../../../settings/server'; | ||
import { Livechat } from '../../../livechat/server/lib/Livechat'; | ||
|
||
type SubscribedRooms = { | ||
rid: string; | ||
t: string; | ||
} | ||
|
||
export const closeOmnichannelConversations = (user: IUser, subscribedRooms: SubscribedRooms[]): void => { | ||
const roomsInfo = LivechatRooms.findByIds(subscribedRooms.map(({ rid }) => rid)); | ||
const language = settings.get('Language') || 'en'; | ||
roomsInfo.map((room: any) => | ||
Livechat.closeRoom({ user, visitor: {}, room, comment: TAPi18n.__('Agent_deactivated', { lng: language }) }), | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters