From f5ed0dc2e64ed6a59fe3edd1cf41acfddd97daa8 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 13 Nov 2019 12:59:01 -0500 Subject: [PATCH] FIX: Failing tests --- app/assets/javascripts/discourse.js.es6 | 8 +++----- app/assets/javascripts/discourse/models/user.js.es6 | 5 +++++ test/javascripts/test_helper.js | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index 44c11ff9dbc..38ea5dd7bbd 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -61,11 +61,9 @@ const Discourse = Ember.Application.extend(FocusEvent, { $("title").text(title); } - var displayCount = this.displayCount; - var dynamicFavicon = this.currentUser - ? !this.currentUser.get("dynamic_favicon") - : false; - if (displayCount > 0 && dynamicFavicon) { + let displayCount = this.displayCount; + let dynamicFavicon = this.currentUser && this.currentUser.dynamic_favicon; + if (displayCount > 0 && !dynamicFavicon) { title = `(${displayCount}) ${title}`; } diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index d3e540aa911..830e9a399ac 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -853,6 +853,11 @@ User.reopenClass(Singleton, { return null; }, + resetCurrent(user) { + this._super(user); + Discourse.currentUser = user; + }, + checkUsername(username, email, for_user_id) { return ajax(userPath("check_username"), { data: { username, email, for_user_id } diff --git a/test/javascripts/test_helper.js b/test/javascripts/test_helper.js index d0fc2b45c0e..de63b47b730 100644 --- a/test/javascripts/test_helper.js +++ b/test/javascripts/test_helper.js @@ -124,7 +124,6 @@ QUnit.testStart(function(ctx) { Session.resetCurrent(); User.resetCurrent(); resetSite(Discourse.SiteSettings); - Discourse.currentUser = User.current(); _DiscourseURL.redirectedTo = null; _DiscourseURL.redirectTo = function(url) {