From 66b015b472b1d120ae8d61c7018bba390e3a399c Mon Sep 17 00:00:00 2001
From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com>
Date: Fri, 3 Feb 2023 07:47:41 -0600
Subject: [PATCH] DEV: Remove 'widget-button' from glimmer-topic-timeline
(#20155)
# Context
The class of `widget-button` was kept in the upgraded version of the topic timeline to keep the preexisting logic of how we open / close child and parent modals.
# Problem
With the `widget-button` class removed from the topic timeline, clicking the button (highlighted in the image above) would close itself when populating the `jumpToPostPrompt` modal. This is not the behavior we want so class was kept on the button. The upgrade to ember octane entails moving away from widgets and all of its functionality... so we don't want to carry the debt of utilizing the `widget-button` class.
# Solution
Create a new class `.timeline-open-jump-to-post-prompt-btn` to be added to the `_expanded` function. When this class is present on a child or a parent of the button clicked, we do not collapse the modal. This gives us the expected behavior of maintaining both modals open at the same time.
# Other
Obviously adding this as jquery is not ideal, but to prevent scope creep we will need to refactor this in a separate PR.
---
.../javascripts/discourse/app/components/topic-navigation.js | 4 +++-
.../discourse/app/components/topic-timeline/container.hbs | 3 +--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/assets/javascripts/discourse/app/components/topic-navigation.js b/app/assets/javascripts/discourse/app/components/topic-navigation.js
index 6bcea0da5fe..447933706a8 100644
--- a/app/assets/javascripts/discourse/app/components/topic-navigation.js
+++ b/app/assets/javascripts/discourse/app/components/topic-navigation.js
@@ -93,7 +93,9 @@ export default Component.extend(PanEvents, {
!$target.is("#discourse-modal") &&
!$parents.is(".modal-footer") &&
($target.is(".topic-timeline") ||
- !$parents.is("#topic-progress-wrapper"))
+ !$parents.is("#topic-progress-wrapper")) &&
+ !$parents.is(".timeline-open-jump-to-post-prompt-btn") &&
+ !$target.is(".timeline-open-jump-to-post-prompt-btn")
) {
this._collapseFullscreen();
}
diff --git a/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs b/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs
index baf9cc09920..59371e84be7 100644
--- a/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs
+++ b/app/assets/javascripts/discourse/app/components/topic-timeline/container.hbs
@@ -146,8 +146,7 @@
{{#if @fullscreen}}