DEV: Don't print warning about attempt to track status of a user without id in tests (#23228)

It is hard to catch and debug potential bugs related to live updates of 
user status (though, we haven't seen many such bugs so far). We have 
this `console.warn` statement that should help us to catch one class of 
such bugs:

70f1cc5552/app/assets/javascripts/discourse/app/models/user.js (L1384-L1389)

But in tests, we quite often operate with stubs of users that don't have ID, 
and this warning create unnecessary noise. This PR disable the warning in 
the testing environment.
This commit is contained in:
Andrei Prigorshnev 2023-08-24 21:32:13 +04:00 committed by GitHub
parent 1e59e18ad2
commit c519d60d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1381,7 +1381,7 @@ User.reopen(Evented, {
// always call stopTrackingStatus() when done with a user
trackStatus() {
if (!this.id) {
if (!this.id && !isTesting()) {
// eslint-disable-next-line no-console
console.warn(
"It's impossible to track user status on a user model that doesn't have id. This user model won't be receiving live user status updates."