Skip to content

A platform for community discussion. Free, open, simple.

FIX: Turn off bulk select after dismissing topics (#38790)

Régis Hanolf369c4d2c72e
diff --git a/frontend/discourse/app/lib/bulk-select-helper.js b/frontend/discourse/app/lib/bulk-select-helper.js
index f9fd946dadd..83fbfe50a1a 100644
--- a/frontend/discourse/app/lib/bulk-select-helper.js
+++ b/frontend/discourse/app/lib/bulk-select-helper.js
@@ -90,6 +90,8 @@ export default class BulkSelectHelper {
this.modal.close();
this.router.refresh();
+ this.bulkSelectEnabled = false;
+ this.clear();
});
}
}
diff --git a/spec/system/page_objects/components/topic_list.rb b/spec/system/page_objects/components/topic_list.rb
index 05484508d35..bafaa8b9caa 100644
--- a/spec/system/page_objects/components/topic_list.rb
+++ b/spec/system/page_objects/components/topic_list.rb
@@ -38,6 +38,10 @@ module PageObjects
page.has_css?("#{topic_list_item_class(topic)} input#bulk-select-#{topic.id}")
end
+ def has_no_topic_checkbox?(topic)
+ page.has_no_css?("#{topic_list_item_class(topic)} input#bulk-select-#{topic.id}")
+ end
+
def has_closed_status?(topic)
page.has_css?("#{topic_list_item_closed(topic)}")
end
diff --git a/spec/system/topic_bulk_select_spec.rb b/spec/system/topic_bulk_select_spec.rb
index 48ef2057aec..b51411e5d30 100644
--- a/spec/system/topic_bulk_select_spec.rb
+++ b/spec/system/topic_bulk_select_spec.rb
@@ -46,6 +46,26 @@ describe "Topic bulk select" do
expect(page).to have_text(I18n.t("js.topics.none.education.unread"))
end
+
+ it "turns off bulk select after dismissing" do
+ other_topic = Fabricate(:topic, user: admin)
+ create_post(user: admin, topic: other_topic)
+ create_post(topic: other_topic)
+
+ sign_in(admin)
+ visit("/unread")
+
+ topic_list_header.click_bulk_select_button
+ topic_list.click_topic_checkbox(topic)
+
+ topic_list_header.click_bulk_select_topics_dropdown
+ topic_list_header.click_bulk_button("dismiss-unread")
+
+ topic_bulk_actions_modal.click_dismiss_confirm
+
+ expect(topic_list).to have_topic(other_topic)
+ expect(topic_list).to have_no_topic_checkbox(other_topic)
+ end
end
context "when dismissing new topics" do
@@ -68,6 +88,25 @@ describe "Topic bulk select" do
expect(page).to have_text(I18n.t("js.topics.none.education.new"))
end
+
+ it "turns off bulk select after dismissing" do
+ other_topic = Fabricate(:topic, user: user)
+ create_post(user: user, topic: other_topic)
+
+ sign_in(admin)
+ visit("/new")
+
+ topic_list_header.click_bulk_select_button
+ topic_list.click_topic_checkbox(topic)
+
+ topic_list_header.click_bulk_select_topics_dropdown
+ topic_list_header.click_bulk_button("dismiss-new")
+
+ topic_bulk_actions_modal.click_dismiss_confirm
+
+ expect(topic_list).to have_topic(other_topic)
+ expect(topic_list).to have_no_topic_checkbox(other_topic)
+ end
end
context "when appending tags" do