Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

[FIX] 'Hide agent info' not working on system message #651

Merged
merged 5 commits into from
Oct 20, 2021
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/Messages/Message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const renderContent = ({
),
].filter(Boolean);

const getSystemMessageText = ({ t, conversationFinishedMessage, transferData }) =>
const getSystemMessageText = ({ t, conversationFinishedMessage, transferData, u }) =>
(t === MESSAGE_TYPE_ROOM_NAME_CHANGED && I18n.t('Room name changed'))
|| (t === MESSAGE_TYPE_USER_ADDED && I18n.t('User added by'))
|| (t === MESSAGE_TYPE_USER_REMOVED && I18n.t('User removed by'))
Expand All @@ -89,7 +89,7 @@ const getSystemMessageText = ({ t, conversationFinishedMessage, transferData })
|| (t === MESSAGE_TYPE_WELCOME && I18n.t('Welcome'))
|| (t === MESSAGE_TYPE_LIVECHAT_CLOSED && (conversationFinishedMessage || I18n.t('Conversation finished')))
|| (t === MESSAGE_TYPE_LIVECHAT_STARTED && I18n.t('Chat started'))
|| (t === MESSAGE_TYPE_LIVECHAT_TRANSFER_HISTORY && normalizeTransferHistoryMessage(transferData));
|| (t === MESSAGE_TYPE_LIVECHAT_TRANSFER_HISTORY && normalizeTransferHistoryMessage(transferData, u));

const getMessageUsernames = (compact, message) => {
if (compact || !message.u) {
Expand Down
19 changes: 19 additions & 0 deletions src/components/Messages/MessageList/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ storiesOf('Messages/MessageList', module)
onScrollTo={action('scrollTo')}
/>
))
.add('with hidden agent info system message', () => (
<MessageList
messages={object('messages', [...messages, {
msg: '',
t: MESSAGE_TYPE_LIVECHAT_TRANSFER_HISTORY,
transferData: {
transferredBy: { ...users[0], username: undefined },
scope: 'queue',
},
u: { ...users[0], username: undefined },
_id: 'AGiTzCjYyaypDxpDm',
}])}
uid={number('uid', 1)}
avatarResolver={avatarResolver}
lastReadMessageId={number('lastReadMessageId', 7)}
typingUsernames={object('typingUsernames', [])}
onScrollTo={action('scrollTo')}
/>
))
.add('with typing users', () => (
<MessageList
messages={object('messages', messages)}
Expand Down
12 changes: 10 additions & 2 deletions src/components/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const sortArrayByColumn = (array, column, inverted) => array.sort((a, b)
return 1;
});

export const normalizeTransferHistoryMessage = (transferData) => {
export const normalizeTransferHistoryMessage = (transferData, sender) => {
if (!transferData) {
return;
}
Expand All @@ -146,14 +146,22 @@ export const normalizeTransferHistoryMessage = (transferData) => {

const transferTypes = {
agent: () => {
if (!sender.username) {
return I18n.t('The chat was transferred to another agent');
}
const to = transferredTo && (transferredTo.name || transferredTo.username);
return I18n.t('%{from} transferred the chat to %{to}', { from, to });
},
department: () => {
const to = nextDepartment && nextDepartment.name;
return I18n.t('%{from} transferred the chat to the department %{to}', { from, to });
},
queue: () => I18n.t('%{from} returned the chat to the queue', { from }),
queue: () => {
if (!sender.username) {
return I18n.t('The chat was moved back to queue');
}
return I18n.t('%{from} returned the chat to the queue', { from });
},
};

return transferTypes[scope]();
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/be_BY.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
7 changes: 7 additions & 0 deletions src/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Změnit Oddělení",
"chat_finished_effbd589": "Chat Ukončen",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Vybrat oddělení...",
"choose_a_department_fe9755fd": "Vybrat oddělení",
"choose_an_option_26ac97d2": "Vybrat možnost...",
Expand All @@ -32,6 +33,9 @@
"fileupload_error_9eedee68": "Chyba při nahrávání souboru",
"finish_this_chat_87b79542": "Ukončit tento chat",
"forget_remove_my_data_e1d68cdd": "Zapomenout/Odebrat mé údaje",
"from_returned_the_chat_to_the_queue_3edcd32": "%{from} returned the chat to the queue",
"from_transferred_the_chat_to_the_department_to_752ab298": "%{from} transferred the chat to the department %{to}",
"from_transferred_the_chat_to_to_15bdcb11": "%{from} transferred the chat to %{to}",
"gdpr_8b366c2b": "GDPR",
"go_to_menu_options_forget_remove_my_personal_data__99c40934": "Přejít do **možnosti nabídky → Zapomenout/Odebrat mé osobní údaje** vyžádat okamžité odstranění Vašich osobních údajů.",
"hiddenelementscount_more_c017d614": "+ %{hiddenElementsCount} more",
Expand All @@ -46,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat není připojen.",
"media_types_not_accepted_4e25676a": "Typy příloh nebyly přijaty.",
"message_5c38209d": "Zpráva",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimalizovat chat",
"name_1aed4a1b": "Jméno",
"need_help_803a61": "Potřebujete pomoc?",
Expand All @@ -64,6 +69,8 @@
"sound_is_on_98a9ec58": "Zvuk je zapnutý",
"start_chat_8606d464": "Zahájit konverzaci",
"thanks_for_talking_with_us_719cce22": "Děkujeme, že jste s námi hovořil",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "Správcem vašich osobních údajů je [Název společnosti] se sídlem [Adresa společnosti]. Zahájením konverzace souhlaste s tím, že vaše osobní údaje budou zpracovávány a předávány v souladu s obecným nařízením o ochraně údajů (GDPR).",
"type_your_message_here_6a05bd0f": "Zde napište svou zprávu",
"unread_messages_5e18e7b7": "nepřečtené zprávy",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"change_department_523a16e8": "Change Department",
"chat_finished_effbd589": "Chat Finished",
"chat_now_3d7f6769": "Chat now",
"chat_started_3b1db6d6": "Chat started",
"choose_a_department_b106da55": "Choose a department...",
"choose_a_department_fe9755fd": "Choose a department",
"choose_an_option_26ac97d2": "Choose an option...",
Expand Down Expand Up @@ -49,6 +50,7 @@
"livechat_is_not_connected_b40328ca": "Livechat is not connected.",
"media_types_not_accepted_4e25676a": "Media Types Not Accepted.",
"message_5c38209d": "Message",
"messages_64e7435f": "Messages",
"minimize_chat_804b3135": "Minimize chat",
"name_1aed4a1b": "Name",
"need_help_803a61": "Need help?",
Expand All @@ -67,6 +69,8 @@
"sound_is_on_98a9ec58": "Sound is on",
"start_chat_8606d464": "Start chat",
"thanks_for_talking_with_us_719cce22": "Thanks for talking with us",
"the_chat_was_moved_back_to_queue_cefbade6": "The chat was moved back to queue",
"the_chat_was_transferred_to_another_agent_b375bdac": "The chat was transferred to another agent",
"the_controller_of_your_personal_data_is_company_na_c82f5567": "The controller of your personal data is [Company Name], with registered office at [Company Address]. To start the chat you agree that your personal data shall be processed and trasmitted in accordance with the General Data Protection Regulation (GDPR).",
"type_your_message_here_6a05bd0f": "Type your message here",
"unread_messages_5e18e7b7": "unread messages",
Expand Down
Loading