Skip to content

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

DEV: attempt to fix some system spec flakes (#30182)

Régis Hanol35656a1d5fe8
diff --git a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.gjs b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.gjs
index 7da31830ce8..e975510342b 100644
--- a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.gjs
+++ b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.gjs
@@ -33,6 +33,12 @@ export default class ComposerPresenceDisplay extends Component {
});
setupWhisperChannel = helperFn((_, on) => {
+ // NOTE: this is here to prevent some flakes in tests
+ // For some random reasons, this component is being rendered even though `currentUser` is `null`
+ if (!this.currentUser) {
+ return;
+ }
+
const { topic } = this.args.model;
const { whisperer } = this.currentUser;
diff --git a/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.gjs b/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.gjs
index e85890bb6bf..5df9df8beb3 100644
--- a/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.gjs
+++ b/plugins/discourse-presence/assets/javascripts/discourse/components/topic-presence-display.gjs
@@ -30,6 +30,12 @@ export default class TopicPresenceDisplay extends Component {
});
setupWhisperChannel = helperFn((_, on) => {
+ // NOTE: this is here to prevent some flakes in tests
+ // For some random reasons, this component is being rendered even though `currentUser` is `null`
+ if (!this.currentUser) {
+ return;
+ }
+
const { topic } = this.args;
const { whisperer } = this.currentUser;