Skip to content

A platform for community discussion. Free, open, simple.

Revert "FIX: delay custom section reorder (#20781)" (#20786)

Joffrey JAFFEUX165a3217c88c
diff --git a/app/assets/javascripts/discourse-common/addon/config/environment.js b/app/assets/javascripts/discourse-common/addon/config/environment.js
index 89e34fc3b1f..5208c1f7568 100644
--- a/app/assets/javascripts/discourse-common/addon/config/environment.js
+++ b/app/assets/javascripts/discourse-common/addon/config/environment.js
@@ -13,7 +13,7 @@ export function setEnvironment(e) {
}
export function isTesting() {
- return environment === "testing" || environment === "test";
+ return environment === "testing";
}
// Generally means "before we migrated to Ember CLI"
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/user/section-link.js b/app/assets/javascripts/discourse/app/components/sidebar/user/section-link.js
index 064d7afd6a3..bf71db0cfcf 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/user/section-link.js
+++ b/app/assets/javascripts/discourse/app/components/sidebar/user/section-link.js
@@ -1,7 +1,6 @@
import { tracked } from "@glimmer/tracking";
import { bind } from "discourse-common/utils/decorators";
import RouteInfoHelper from "discourse/lib/sidebar/route-info-helper";
-import { isTesting } from "discourse-common/config/environment";
export default class SectionLink {
@tracked linkDragCss;
@@ -23,25 +22,8 @@ export default class SectionLink {
}
@bind
- didStartDrag(event) {
- // 0 represents left button of the mouse
- if (event.button === 0) {
- this.willDrag = true;
- setTimeout(
- () => {
- this.delayedStart(event);
- },
- isTesting() ? 0 : 300
- );
- }
- }
- delayedStart(event) {
- if (this.willDrag) {
- this.mouseY = event.screenY;
- this.linkDragCss = "drag";
- this.section.disable();
- this.drag = true;
- }
+ didStartDrag(e) {
+ this.mouseY = e.screenY;
}
@bind
@@ -50,16 +32,11 @@ export default class SectionLink {
this.mouseY = null;
this.section.enable();
this.section.reorder();
- this.willDrag = false;
- this.drag = false;
}
@bind
- dragMove(event) {
- if (!this.drag) {
- return;
- }
- const currentMouseY = event.screenY;
+ dragMove(e) {
+ const currentMouseY = e.screenY;
const distance = currentMouseY - this.mouseY;
if (!this.linkHeight) {
this.linkHeight = document.getElementsByClassName(
@@ -78,5 +55,7 @@ export default class SectionLink {
this.mouseY = currentMouseY;
}
}
+ this.linkDragCss = "drag";
+ this.section.disable();
}
}
diff --git a/app/assets/stylesheets/common/base/sidebar-custom-section.scss b/app/assets/stylesheets/common/base/sidebar-custom-section.scss
index 69bd20934c6..c53d8b78afc 100644
--- a/app/assets/stylesheets/common/base/sidebar-custom-section.scss
+++ b/app/assets/stylesheets/common/base/sidebar-custom-section.scss
@@ -16,9 +16,6 @@
}
.sidebar-section-wrapper.disabled {
- a {
- pointer-events: none;
- }
.sidebar-section-link-wrapper {
.sidebar-section-link-prefix.icon,
.sidebar-section-link {