From b66b35f0fdeca087c20d1b5a604b19460db53cfd Mon Sep 17 00:00:00 2001
From: dgt <digitaria@riseup.net>
Date: Tue, 15 May 2018 22:41:03 +0200
Subject: [PATCH] Remove some unused track_actions and bring back the
 track_action for starred posts

we do not track starred pages but only starred posts
---
 app/controllers/common/requests.rb              | 9 ---------
 app/controllers/group/groups_controller.rb      | 1 -
 app/controllers/group/memberships_controller.rb | 3 ---
 app/controllers/group/requests_controller.rb    | 6 ------
 app/controllers/group/structures_controller.rb  | 6 ------
 app/controllers/stars_controller.rb             | 1 +
 6 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/app/controllers/common/requests.rb b/app/controllers/common/requests.rb
index 62b68eb8d..476a71c50 100644
--- a/app/controllers/common/requests.rb
+++ b/app/controllers/common/requests.rb
@@ -8,16 +8,12 @@
 module Common::Requests
   extend ActiveSupport::Concern
 
-  include Common::Tracking::Action
-
   included do
     helper_method :current_state
     helper_method :request_path
     helper_method :requests_path
     before_filter :fetch_request, only: %i[update destroy show]
 
-    track_actions :update, if: :approved?
-
     after_filter :create_notices, only: :create
     after_filter :dismiss_notices, only: :update
   end
@@ -105,11 +101,6 @@ module Common::Requests
     end
   end
 
-  def track_action(event = nil, options = {})
-    event ||= @req.event
-    super event, @req.event_attrs.merge(options)
-  end
-
   def create_notices
     Notice::RequestNotice.create! @req if @req.persisted?
   end
diff --git a/app/controllers/group/groups_controller.rb b/app/controllers/group/groups_controller.rb
index f40e51b11..05b08e3d1 100644
--- a/app/controllers/group/groups_controller.rb
+++ b/app/controllers/group/groups_controller.rb
@@ -12,7 +12,6 @@ class Group::GroupsController < Group::BaseController
   before_filter :initialize_group, only: %w[new create]
   before_filter :fetch_associations, only: :destroy
 
-  track_actions :create
   after_filter :notify_former_users, only: :destroy
 
   guard :may_ALIAS_group?
diff --git a/app/controllers/group/memberships_controller.rb b/app/controllers/group/memberships_controller.rb
index 90327cf4b..4036e417c 100644
--- a/app/controllers/group/memberships_controller.rb
+++ b/app/controllers/group/memberships_controller.rb
@@ -5,14 +5,11 @@
 #
 
 class Group::MembershipsController < Group::BaseController
-  include Common::Tracking::Action
 
   guard index: :may_list_memberships?,
         destroy: :may_destroy_membership?,
         create: :may_create_membership?
 
-  track_actions :create, :destroy, unless: :federation_view?
-
   #
   # list all the memberships
   #
diff --git a/app/controllers/group/requests_controller.rb b/app/controllers/group/requests_controller.rb
index 61b29c874..23edc45ad 100644
--- a/app/controllers/group/requests_controller.rb
+++ b/app/controllers/group/requests_controller.rb
@@ -12,8 +12,6 @@ class Group::RequestsController < Group::BaseController
   # permissions handled by model:
   guard create: :allow, update: :allow, destroy: :allow
 
-  track_actions :create
-
   rescue_render create: :index
 
   def index
@@ -48,10 +46,6 @@ class Group::RequestsController < Group::BaseController
     REQUEST_TYPES[params[:type]].try.constantize
   end
 
-  def track_action
-    super "request_to_#{params[:type]}" if REQUEST_TYPES.key? params[:type]
-  end
-
   def current_view
     case params[:view]
     when 'incoming' then :to_group
diff --git a/app/controllers/group/structures_controller.rb b/app/controllers/group/structures_controller.rb
index 05c91330e..70ba7f143 100644
--- a/app/controllers/group/structures_controller.rb
+++ b/app/controllers/group/structures_controller.rb
@@ -1,10 +1,7 @@
 class Group::StructuresController < Group::SettingsController
-  include Common::Tracking::Action
 
   guard :may_edit_group_structure?, actions: %i[new create destroy]
 
-  track_actions :create
-
   def show; end
 
   def new
@@ -47,7 +44,4 @@ class Group::StructuresController < Group::SettingsController
     params.fetch(:group, {}).permit :name, :full_name, :language
   end
 
-  def track_action
-    super("#{action_string}_group", group: @committee)
-  end
 end
diff --git a/app/controllers/stars_controller.rb b/app/controllers/stars_controller.rb
index ef58db009..fceb432c4 100644
--- a/app/controllers/stars_controller.rb
+++ b/app/controllers/stars_controller.rb
@@ -24,6 +24,7 @@ class StarsController < ApplicationController
   include Common::Tracking::Action
 
   before_filter :fetch_starred
+  track_actions :create
 
   def create
     @starred.stars.create(user: current_user)
-- 
GitLab