DEV: stop mixing in application helper where not needed

DEV: stop mixing in application helper where not needed

We were mixing in 20 or so methods into a controller just to use a single one.

The helper itself is not the actual implementation anyway… MobileDetection is responsible here.

diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 461a980..f0ed98e 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -1,8 +1,6 @@
 # frozen_string_literal: true
 
 class GroupsController < ApplicationController
-  include ApplicationHelper
-
   requires_login only: [
     :set_notifications,
     :mentionable,
@@ -46,7 +44,7 @@ class GroupsController < ApplicationController
       raise Discourse::InvalidAccess.new(:enable_group_directory)
     end
 
-    page_size = mobile_device? ? 15 : 36
+    page_size = MobileDetection.mobile_device?(request.user_agent) ? 15 : 36
     page = params[:page]&.to_i || 0
     order = %w{name user_count}.delete(params[:order])
     dir = params[:asc] ? 'ASC' : 'DESC'

GitHub sha: 3d5f71da

1 Like