From 3a2319be2b1a22b53adecbf104e702410c6b33d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?=
<1108771+megothss@users.noreply.github.com>
Date: Tue, 28 May 2024 21:48:55 -0300
Subject: [PATCH] Revert "DEV: Update how we determine the presence of a topic
in the header (#27138)" (#27234)
This reverts commit caa29ec97351f1443f7be9560187116f045b820b.
---
.../javascripts/discourse/app/components/discourse-topic.js | 4 ++--
app/assets/javascripts/discourse/app/components/header.gjs | 2 +-
.../discourse/app/components/header/auth-buttons.gjs | 2 +-
.../javascripts/discourse/app/components/header/contents.gjs | 4 ++--
.../javascripts/discourse/app/routes/topic-from-params.js | 3 ---
app/assets/javascripts/discourse/app/services/header.js | 1 -
6 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/app/assets/javascripts/discourse/app/components/discourse-topic.js b/app/assets/javascripts/discourse/app/components/discourse-topic.js
index 2a3a0161c31..4253cbb8034 100644
--- a/app/assets/javascripts/discourse/app/components/discourse-topic.js
+++ b/app/assets/javascripts/discourse/app/components/discourse-topic.js
@@ -56,7 +56,7 @@ export default Component.extend(Scrolling, MobileScrollDirection, {
_hideTopicInHeader() {
this.appEvents.trigger("header:hide-topic");
- this.header.inTopic = false;
+ this.header.topic = null;
this._lastShowTopic = false;
},
@@ -65,7 +65,7 @@ export default Component.extend(Scrolling, MobileScrollDirection, {
return;
}
this.appEvents.trigger("header:show-topic", topic);
- this.header.inTopic = true;
+ this.header.topic = topic;
this._lastShowTopic = true;
},
diff --git a/app/assets/javascripts/discourse/app/components/header.gjs b/app/assets/javascripts/discourse/app/components/header.gjs
index 0a030e181b5..54b33121332 100644
--- a/app/assets/javascripts/discourse/app/components/header.gjs
+++ b/app/assets/javascripts/discourse/app/components/header.gjs
@@ -242,7 +242,7 @@ export default class GlimmerHeader extends Component {
diff --git a/app/assets/javascripts/discourse/app/components/header/auth-buttons.gjs b/app/assets/javascripts/discourse/app/components/header/auth-buttons.gjs
index 72f58757440..713e8b44bc3 100644
--- a/app/assets/javascripts/discourse/app/components/header/auth-buttons.gjs
+++ b/app/assets/javascripts/discourse/app/components/header/auth-buttons.gjs
@@ -8,7 +8,7 @@ export default class AuthButtons extends Component {
- {{#if (and @canSignUp (not this.header.inTopic))}}
+ {{#if (and @canSignUp (not this.header.topic))}}
- {{#if this.header.inTopic}}
+ {{#if this.header.topic}}
{{else if
(and
diff --git a/app/assets/javascripts/discourse/app/routes/topic-from-params.js b/app/assets/javascripts/discourse/app/routes/topic-from-params.js
index 939567648fe..10cb2d8e7a6 100644
--- a/app/assets/javascripts/discourse/app/routes/topic-from-params.js
+++ b/app/assets/javascripts/discourse/app/routes/topic-from-params.js
@@ -10,7 +10,6 @@ import { isTesting } from "discourse-common/config/environment";
// This route is used for retrieving a topic based on params
export default DiscourseRoute.extend({
composer: service(),
- header: service(),
// Avoid default model hook
model(params) {
@@ -45,8 +44,6 @@ export default DiscourseRoute.extend({
if (topic.isPrivateMessage && topic.suggested_topics) {
this.pmTopicTrackingState.startTracking();
}
-
- this.header.topic = topic;
},
deactivate() {
diff --git a/app/assets/javascripts/discourse/app/services/header.js b/app/assets/javascripts/discourse/app/services/header.js
index 4925d2531ac..e88007b1635 100644
--- a/app/assets/javascripts/discourse/app/services/header.js
+++ b/app/assets/javascripts/discourse/app/services/header.js
@@ -7,7 +7,6 @@ export default class Header extends Service {
@service siteSettings;
@tracked topic = null;
- @tracked inTopic = false;
@tracked hamburgerVisible = false;
@tracked userVisible = false;
@tracked anyWidgetHeaderOverrides = false;