Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 organization’s space to collaborate. Ask the workspace admin for address to join or create one for your team.',
Onboarding_join_workspace: 'Join a workspace',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
17 changes: 14 additions & 3 deletions app/views/RoomsListView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -414,7 +417,8 @@ class RoomsListView extends React.Component {
sortBy,
showUnread,
showFavorites,
groupByType
groupByType,
user
} = this.props;

const db = database.active;
Expand Down Expand Up @@ -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));
Expand All @@ -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;
Expand Down