From 7b165c6c2f4628221ff38fa9fd9538de538079f3 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Fri, 8 Sep 2023 18:26:56 -0500 Subject: [PATCH] Revert "DEV: Replace BulkTopicSelection mixin with a helper object (#23268)" (#23484) This reverts commit 206969e49d89807b6eed2a3057e77cab1ecc2e7b. --- .../app/components/bulk-select-toggle.hbs | 6 +- .../app/components/bulk-select-toggle.js | 18 ++-- .../discourse/app/components/d-navigation.hbs | 2 +- .../app/controllers/discovery/topics.js | 50 ++--------- .../discourse/app/controllers/tag-show.js | 50 ++--------- .../app/controllers/user-topics-list.js | 41 ++-------- .../discourse/app/lib/bulk-select-helper.js | 66 --------------- .../discourse/app/lib/filter-mode.js | 2 +- .../app/mixins/bulk-topic-selection.js | 82 +++++++++++++++++++ .../app/routes/build-category-route.js | 2 +- .../routes/build-private-messages-route.js | 2 +- .../discourse/app/routes/build-topic-route.js | 2 +- .../user-private-messages-tags-index.js | 2 +- .../discourse/app/templates/user/messages.hbs | 2 +- 14 files changed, 127 insertions(+), 200 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/lib/bulk-select-helper.js create mode 100644 app/assets/javascripts/discourse/app/mixins/bulk-topic-selection.js diff --git a/app/assets/javascripts/discourse/app/components/bulk-select-toggle.hbs b/app/assets/javascripts/discourse/app/components/bulk-select-toggle.hbs index e0b31d677f3..2caf4cb5717 100644 --- a/app/assets/javascripts/discourse/app/components/bulk-select-toggle.hbs +++ b/app/assets/javascripts/discourse/app/components/bulk-select-toggle.hbs @@ -1 +1,5 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js b/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js index 09e2a1c22f1..80ddbc7decc 100644 --- a/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js +++ b/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js @@ -1,15 +1,17 @@ -import Component from "@glimmer/component"; +import Component from "@ember/component"; import { action } from "@ember/object"; import { getOwner } from "discourse-common/lib/get-owner"; -export default class BulkSelectToggle extends Component { +export default Component.extend({ + parentController: null, + @action toggleBulkSelect() { const controller = getOwner(this).lookup( - `controller:${this.args.parentController}` + `controller:${this.parentController}` ); - const helper = controller.bulkSelectHelper; - helper.clear(); - helper.bulkSelectEnabled = !helper.bulkSelectEnabled; - } -} + const selection = controller.selected; + controller.toggleProperty("bulkSelectEnabled"); + selection.clear(); + }, +}); diff --git a/app/assets/javascripts/discourse/app/components/d-navigation.hbs b/app/assets/javascripts/discourse/app/components/d-navigation.hbs index 98907cbba12..ae8e4a23b25 100644 --- a/app/assets/javascripts/discourse/app/components/d-navigation.hbs +++ b/app/assets/javascripts/discourse/app/components/d-navigation.hbs @@ -17,7 +17,7 @@