Skip to content

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

FIX: Failing tests

Robin Wardf5ed0dc2e64e
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) {