A platform for community discussion. Free, open, simple.
FIX: Correctly toggle bulk select checkboxes for regular users (#29984)
Penar Musarajcd4de88e4ae0
diff --git a/app/assets/javascripts/discourse/app/components/topic-list.js b/app/assets/javascripts/discourse/app/components/topic-list.jsindex 4a4ee62697e..c425dc1a666 100644--- a/app/assets/javascripts/discourse/app/components/topic-list.js+++ b/app/assets/javascripts/discourse/app/components/topic-list.js@@ -72,7 +72,9 @@ export default class TopicList extends Component.extend(LoadMore) {// for the classNameBindings@dependentKeyCompatget bulkSelectEnabled() {- return this.bulkSelectHelper?.bulkSelectEnabled;+ return (+ this.get("canBulkSelect") && this.bulkSelectHelper?.bulkSelectEnabled+ );}get toggleInTitle() {diff --git a/spec/system/discovery_list_spec.rb b/spec/system/discovery_list_spec.rbindex 1ac2c564016..364a039fe6b 100644--- a/spec/system/discovery_list_spec.rb+++ b/spec/system/discovery_list_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-describe "Topic list focus", type: :system do+describe "Discovery list", type: :system dofab!(:topics) { Fabricate.times(10, :post).map(&:topic) }fab!(:reply) { Fabricate(:post, topic: topics.first) }@@ -38,4 +38,27 @@ describe "Topic list focus", type: :system doexpect(page).to have_css("th[data-sort-order='posts'][aria-sort=ascending]")expect(nth_topic_id(10)).to eq(reply.topic_id.to_s)end++ describe "bulk topic options" do+ fab!(:user)+ fab!(:topic) { Fabricate(:topic, user: user) }+ fab!(:post1) { create_post(user: user, topic: topic) }+ fab!(:post2) { create_post(topic: topic) }++ it "should correctly show/hide the bulk select toggle for regular users" do+ sign_in(user)+ visit("/unread")++ # The bulk select toggle should be visible, the user has an unread post+ find("button.bulk-select").click+ expect(page).to have_css(".topic-list-body .bulk-select")++ find("#navigation-bar .latest > a").click++ # No bulk select toggle or checkboxes+ # this action is not available for this user in /latest+ expect(page).to have_no_css(".topic-list-body .bulk-select")+ expect(page).to have_no_css("button.bulk-select")+ end+ endend