A platform for community discussion. Free, open, simple.
FIX: 'anon' css class is missing for anonymous users
Vinoth Kannan70b56c8332a5
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rbindex 1ee2f33727a..6009c198247 100644--- a/app/helpers/application_helper.rb+++ b/app/helpers/application_helper.rb@@ -114,6 +114,7 @@ module ApplicationHelperlist << (mobile_device? ? 'mobile-device' : 'not-mobile-device')list << 'rtl' if rtl?list << text_size_class+ list << 'anon' unless current_userlist.join(' ')enddiff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rbindex 0b1aa0ee6c3..594164df9f5 100644--- a/spec/helpers/application_helper_spec.rb+++ b/spec/helpers/application_helper_spec.rb@@ -148,6 +148,8 @@ describe ApplicationHelper doenddescribe '#html_classes' do+ let(:user) { Fabricate(:user) }+it "includes 'rtl' when the I18n.locale is rtl" doI18n.stubs(:locale).returns(:he)expect(helper.html_classes.split(" ")).to include('rtl')@@ -159,7 +161,6 @@ describe ApplicationHelper doendit 'includes the user specified text size' do- user = Fabricate(:user)user.user_option.text_size = "larger"user.user_option.save!helper.request.env[Auth::DefaultCurrentUserProvider::CURRENT_USER_KEY] = user@@ -171,6 +172,12 @@ describe ApplicationHelper doSiteSetting.default_text_size = "largest"expect(helper.html_classes.split(" ")).to include('text-size-largest')end++ it "includes 'anon' for anonymous users and excludes when logged in" do+ expect(helper.html_classes.split(" ")).to include('anon')+ helper.request.env[Auth::DefaultCurrentUserProvider::CURRENT_USER_KEY] = user+ expect(helper.html_classes.split(" ")).not_to include('anon')+ endenddescribe 'gsub_emoji_to_unicode' do