diff --git a/Changelog.md b/Changelog.md index 6f8254e16..7b25f248d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ * Drop outdated/unused mbp-respond.min.js and mbp-modernizr-custom.js [#6257](https://github.com/diaspora/diaspora/pull/6257) * Refactor ApplicationController#after\_sign\_out\_path\_for [#6258](https://github.com/diaspora/diaspora/pull/6258) * Extract StatusMessageService from StatusMessagesController [#6280](https://github.com/diaspora/diaspora/pull/6280) +* Refactor HomeController#toggle\_mobile [#6260](https://github.com/diaspora/diaspora/pull/6260) ## Bug fixes * Fix indentation and a link title on the default home page [#6212](https://github.com/diaspora/diaspora/pull/6212) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index a1803c231..d013c72f2 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -26,13 +26,7 @@ class HomeController < ApplicationController end def toggle_mobile - if session[:mobile_view].nil? - # we're most probably not on mobile, but user wants it anyway - session[:mobile_view] = true - else - # switch from mobile to normal html - session[:mobile_view] = !session[:mobile_view] - end + session[:mobile_view] = session[:mobile_view].nil? ? true : !session[:mobile_view] redirect_to :back end