[IMPROVEMENT] Show "Chats in Progress" group (#2425)

This commit is contained in:
Diego Mello 2020-08-25 09:10:15 -03:00 committed by GitHub
parent 7f7bab8e03
commit 49ea816f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -339,6 +339,7 @@ export default {
Offline: 'Offline',
Oops: 'Oops!',
Omnichannel: 'Omnichannel',
Open_Livechats: 'Chats in Progress',
Omnichannel_enable_alert: 'You\'re not available on Omnichannel. Would you like to be available?',
Onboarding_description: 'A workspace is your team or organizations space to collaborate. Ask the workspace admin for address to join or create one for your team.',
Onboarding_join_workspace: 'Join a workspace',

View File

@ -315,6 +315,7 @@ export default {
No_available_agents_to_transfer: 'Nenhum agente disponível para transferência',
Offline: 'Offline',
Omnichannel: 'Omnichannel',
Open_Livechats: 'Bate-papos em Andamento',
Omnichannel_enable_alert: 'Você não está disponível no Omnichannel. Você quer ficar disponível?',
Oops: 'Ops!',
Onboarding_description: 'Workspace é o espaço de colaboração do seu time ou organização. Peça um convite ou o endereço ao seu administrador ou crie uma workspace para o seu time.',

View File

@ -73,10 +73,12 @@ const DISCUSSIONS_HEADER = 'Discussions';
const CHANNELS_HEADER = 'Channels';
const DM_HEADER = 'Direct_Messages';
const GROUPS_HEADER = 'Private_Groups';
const OMNICHANNEL_HEADER = 'Open_Livechats';
const QUERY_SIZE = 20;
const filterIsUnread = s => (s.unread > 0 || s.alert) && !s.hideUnreadStatus;
const filterIsFavorite = s => s.f;
const filterIsOmnichannel = s => s.t === 'l';
const shouldUpdateProps = [
'searchText',
@ -110,7 +112,8 @@ class RoomsListView extends React.Component {
id: PropTypes.string,
username: PropTypes.string,
token: PropTypes.string,
statusLivechat: PropTypes.string
statusLivechat: PropTypes.string,
roles: PropTypes.object
}),
server: PropTypes.string,
searchText: PropTypes.string,
@ -414,7 +417,8 @@ class RoomsListView extends React.Component {
sortBy,
showUnread,
showFavorites,
groupByType
groupByType,
user
} = this.props;
const db = database.active;
@ -461,6 +465,13 @@ class RoomsListView extends React.Component {
*/
const chatsOrder = data.map(item => item.rid);
const isOmnichannelAgent = user?.roles?.includes('livechat-agent');
if (isOmnichannelAgent) {
const omnichannel = chats.filter(s => filterIsOmnichannel(s));
chats = chats.filter(s => !filterIsOmnichannel(s));
tempChats = this.addRoomsGroup(omnichannel, OMNICHANNEL_HEADER, tempChats);
}
// unread
if (showUnread) {
const unread = chats.filter(s => filterIsUnread(s));
@ -485,7 +496,7 @@ class RoomsListView extends React.Component {
tempChats = this.addRoomsGroup(channels, CHANNELS_HEADER, tempChats);
tempChats = this.addRoomsGroup(privateGroup, GROUPS_HEADER, tempChats);
tempChats = this.addRoomsGroup(direct, DM_HEADER, tempChats);
} else if (showUnread || showFavorites) {
} else if (showUnread || showFavorites || isOmnichannelAgent) {
tempChats = this.addRoomsGroup(chats, CHATS_HEADER, tempChats);
} else {
tempChats = chats;