diff --git a/src/status_im/group_chats/core.cljs b/src/status_im/group_chats/core.cljs index a74c06ea49..b5f324d6e2 100644 --- a/src/status_im/group_chats/core.cljs +++ b/src/status_im/group_chats/core.cljs @@ -209,11 +209,12 @@ (fx/defn ui-leave-chat-pressed {:events [:group-chats.ui/leave-chat-pressed]} - [_ chat-id] - {:ui/show-confirmation - {:title (i18n/label :t/leave-confirmation) - :content (i18n/label :t/leave-chat-confirmation) - :confirm-button-text (i18n/label :t/leave) - :on-accept #(do - (re-frame/dispatch [:bottom-sheet/hide]) - (re-frame/dispatch [:group-chats.ui/leave-chat-confirmed chat-id]))}}) + [{:keys [db]} chat-id] + (let [chat-name (get-in db [:chats chat-id :name])] + {:ui/show-confirmation + {:title (i18n/label :t/leave-confirmation {:chat-name chat-name}) + :content (i18n/label :t/leave-chat-confirmation) + :confirm-button-text (i18n/label :t/leave) + :on-accept #(do + (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:group-chats.ui/leave-chat-confirmed chat-id]))}})) diff --git a/src/status_im/ui/screens/chat/sheets.cljs b/src/status_im/ui/screens/chat/sheets.cljs index 85ae1ce25f..3b3d0ced62 100644 --- a/src/status_im/ui/screens/chat/sheets.cljs +++ b/src/status_im/ui/screens/chat/sheets.cljs @@ -35,12 +35,6 @@ :accessibility-label :mark-all-read-button :icon :main-icons/check :on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-pressed chat-id])}] - [quo/list-item - {:theme :accent - :title (i18n/label :t/clear-history) - :accessibility-label :clear-history-button - :icon :main-icons/close - :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed chat-id])}] [quo/list-item {:theme :negative :title (i18n/label :t/delete-chat) @@ -99,13 +93,7 @@ :title (i18n/label :t/mark-all-read) :accessibility-label :mark-all-read-button :icon :main-icons/check - :on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-pressed chat-id])}] - [quo/list-item - {:theme :accent - :title (i18n/label :t/clear-history) - :accessibility-label :clear-history-button - :icon :main-icons/close - :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed chat-id])}]])) + :on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-pressed chat-id])}]])) (defn group-chat-accents [] (fn [{:keys [chat-id group-chat chat-name color invitation-admin]}] @@ -135,12 +123,6 @@ :accessibility-label :mark-all-read-button :icon :main-icons/check :on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-pressed chat-id])}] - [quo/list-item - {:theme :accent - :title (i18n/label :t/clear-history) - :accessibility-label :clear-history-button - :icon :main-icons/close - :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed chat-id])}] (when joined? [quo/list-item {:theme :negative diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 34ee5f04e4..2381f5620c 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -130,33 +130,33 @@ class TestChatManagement(SingleDeviceTestCase): @marks.testrail_id(5426) @marks.medium - def test_clear_history_via_options(self): + def test_public_clear_history_via_options_and_long_press(self): home = SignInView(self.driver).create_user() - chat = home.add_contact(basic_user['public_key']) home.just_fyi("Creating 3 types of chats") - one_to_one, public, group = basic_user['username'], '#public-clear-options', 'group' + public_options, public_long_press = '#public-clear-options', '#public-long-options' message = 'test message' - chat.home_button.double_click() - home.create_group_chat([basic_user['username']], group) - chat.home_button.double_click() - home.join_public_chat(public[1:]) - chat.get_back_to_home_view() - for chat_name in one_to_one, public, group: - chat = home.get_chat(chat_name).click() + for pub_chat in [public_options[1:], public_long_press[1:]]: + chat = home.join_public_chat(pub_chat) [chat.send_message(message) for _ in range(2)] - chat.clear_history() - if chat.element_by_text(message).is_element_displayed(): - self.errors.append('Messages in %s chat are still shown after clearing history' % chat_name) - chat.get_back_to_home_view() + home.home_button.double_click() + + home.just_fyi('Clearing history via long press') + home.clear_chat_long_press(public_long_press) + + home.just_fyi('Clearing history via options') + chat = home.get_chat(public_options).click() + chat.clear_history() + if chat.element_by_text(message).is_element_displayed(): + self.errors.append('Messages in %s chat are still shown after clearing history via options' % public_options) + + home.just_fyi("Recheck that history won't reappear after relogin") home.relogin() - for chat_name in one_to_one, public, group: - if home.element_by_text(message).is_element_displayed(): - self.errors.append('Messages in %s chat are still shown in Preview after clearing history and relaunch' % chat_name) + for chat_name in public_options, public_long_press: chat = home.get_chat(chat_name).click() - if chat.element_by_text(message).is_element_displayed(): - self.errors.append('Messages in %s chat are shown after clearing history and relauch' % chat_name) - chat.get_back_to_home_view() + if chat.chat_element_by_text(message).is_element_displayed(): + self.errors.append('Messages in %s chat are shown after clearing history and relaunch' % chat_name) + chat.home_button.click() self.errors.verify_no_errors() @@ -247,47 +247,6 @@ class TestChatManagement(SingleDeviceTestCase): self.errors.verify_no_errors() - @marks.testrail_id(5386) - @marks.medium - def test_long_press_to_clear_chat_history(self): - home = SignInView(self.driver).create_user() - messages = [home.get_random_message() for _ in range(3)] - - home.just_fyi("Creating 3 types of chats") - chat = home.add_contact(basic_user['public_key']) - one_to_one, public, group = basic_user['username'], '#public-clear-long-press', 'group' - chat.home_button.click() - home.create_group_chat([basic_user['username']], group) - chat.home_button.click() - home.join_public_chat(public[1:]) - chat.home_button.click() - - home.just_fyi("Clearing history for 3 types of chats and check it will not reappear after re-login") - i = 0 - for chat_name in one_to_one, public, group: - message=messages[i] - chat = home.get_chat(chat_name).click() - chat.send_message(message) - if chat.element_by_text(message).is_element_displayed(): - self.errors.append('Messages in %s chat are still shown after clearing history' % chat_name) - i += 1 - home = chat.home_button.click() - home.clear_chat_long_press(chat_name) - home.relogin() - for message in messages: - if home.element_by_text(message).is_element_displayed(): - self.errors.append('Message is still shown in Preview after clearing history and relaunch') - i = 0 - for chat_name in one_to_one, public, group: - message=messages[i] - chat = home.get_chat(chat_name).click() - if chat.element_by_text(message).is_element_displayed(): - self.errors.append('Messages in %s chat are shown after clearing history and relaunch' % chat_name) - i += 1 - chat.home_button.click() - - self.errors.verify_no_errors() - @marks.testrail_id(6319) @marks.medium def test_deny_access_camera_and_gallery(self): diff --git a/translations/en.json b/translations/en.json index 81e764a996..a0a1a03f17 100644 --- a/translations/en.json +++ b/translations/en.json @@ -595,8 +595,8 @@ "group-chat-name-changed": "**{{member}}** changed the group's name to **{{name}}**", "group-chat-no-contacts": "You don't have any contacts yet.\nInvite your friends to start chatting", "leave-chat":"Leave chat", - "leave-confirmation": "Leave chat", - "leave-chat-confirmation": "Are you sure you want to leave the chat?", + "leave-confirmation": "Leave {{chat-name}}", + "leave-chat-confirmation": "Chat history will be removed from your device. After rejoining you won't be able to retrieve any of your history.", "group-chat-all-contacts-invited": "All your contacts are already in the group", "group-info": "Group info", "gwei": "Gwei",