A platform for community discussion. Free, open, simple.
FIX: Remove broken narrative-bot search context logic (#26319)
David Taylor04e365f7418d
diff --git a/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.js b/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.jsdeleted file mode 100644index 2cf2361121b..00000000000--- a/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.js+++ /dev/null@@ -1,63 +0,0 @@-import { withPluginApi } from "discourse/lib/plugin-api";-import { bind } from "discourse-common/utils/decorators";--export default {- name: "new-user-narrative",-- initialize(container) {- const siteSettings = container.lookup("service:site-settings");-- if (!siteSettings.discourse_narrative_bot_enabled) {- return;- }-- this.messageBus = container.lookup("service:message-bus");- this.appEvents = container.lookup("service:app-events");-- withPluginApi("0.8.7", (api) => {- this.currentUser = api.getCurrentUser();-- if (!this.currentUser) {- return;- }-- api.dispatchWidgetAppEvent(- "site-header",- "header",- "header:search-context-trigger"- );-- api.attachWidgetAction(- "header",- "headerSearchContextTrigger",- function () {- if (this.site.mobileView) {- this.state.skipSearchContext = false;- } else {- this.state.contextEnabled = true;- this.state.searchContextType = "topic";- }- }- );-- this.messageBus.subscribe(- `/new_user_narrative/tutorial_search/${this.currentUser.id}`,- this.onMessage- );- });- },-- teardown() {- if (this.currentUser) {- this.messageBus?.unsubscribe(- `/new_user_narrative/tutorial_search/${this.currentUser.id}`,- this.onMessage- );- }- },-- @bind- onMessage() {- this.appEvents.trigger("header:search-context-trigger");- },-};diff --git a/plugins/discourse-narrative-bot/config/locales/server.en.yml b/plugins/discourse-narrative-bot/config/locales/server.en.ymlindex 2bab753ac5a..b3135aa175d 100644--- a/plugins/discourse-narrative-bot/config/locales/server.en.yml+++ b/plugins/discourse-narrative-bot/config/locales/server.en.yml@@ -314,7 +314,7 @@ en:search:instructions: |-- _psst_ … I’ve hidden a surprise in this topic. If you’re up for the challenge, **select the search icon** <img src="%{base_uri}/plugins/discourse-narrative-bot/images/font-awesome-search.png" width="16" height="16"> at the top right ↗ to search for it.+ _psst_ … I’ve hidden a surprise in this topic. If you’re up for the challenge, **select the search icon** <img src="%{base_uri}/plugins/discourse-narrative-bot/images/font-awesome-search.png" width="16" height="16"> at the top right ↗, choose 'in this topic', then search for it.Try searching for the term "capy​bara" in this topichidden_message: |-diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rbindex d31bd7f2646..b601124f84f 100644--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb@@ -173,12 +173,6 @@ module DiscourseNarrativeBottopic = @post.topicpost = topic.first_post- MessageBus.publish(- "/new_user_narrative/tutorial_search/#{@user.id}",- {},- user_ids: [@user.id],- )-raw = <<~MD#{post.raw}