FIX: don't trigger header:hide-topic at the bottom on desktops

FIX: don’t trigger header:hide-topic at the bottom on desktops

On mobile we trigger header:hide-topic at the very bottom of topics to switch the header contents back from small logo + topic info to large logo + user panels.

Given that the topic-progress component is sometimes loaded on desktop - E.g composer is open or on narrow desktop screens - we need a guard to prevent this logic from firing on desktops.

From c4fca3625543da7f9d60baa664ffe19def35d497 Mon Sep 17 00:00:00 2001
From: Joe <33972521+hnb-ku@users.noreply.github.com>
Date: Fri, 23 Nov 2018 10:14:13 +0800
Subject: [PATCH] FIX: don't trigger header:hide-topic at the bottom on
 desktops

On mobile we trigger `header:hide-topic` at the very bottom of topics to switch the header contents back from small logo + topic info to large logo + user panels.

Given that the `topic-progress` component is sometimes loaded on desktop - E.g composer is open or on narrow desktop screens - we need a guard to prevent this logic from firing on desktops.

diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6
index 1a107c9..5705b73 100644
--- a/app/assets/javascripts/discourse/components/topic-progress.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6
@@ -180,6 +180,10 @@ export default Ember.Component.extend({
     }
 
     // switch mobile scroll logo at the very bottom of topics
+
+    // not a mobile device so don't do anything
+    if (!this.site.mobileView) return;
+
     const isIOS = this.capabilities.isIOS,
       switchHeight = bodyHeight - offset - windowHeight,
       appEvents = getOwner(this).lookup("app-events:main");

GitHub

2 Likes

This commit has been mentioned on Discourse Meta. There might be relevant details there:

1 Like