Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo committed Feb 1, 2025
1 parent 287a075 commit 05d9922
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
29 changes: 15 additions & 14 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
require 'posthog-ruby'

@posthog = PostHog::Client.new(
api_key: Rails.application.secrets.posthog_project_api_key,
host: "https://us.i.posthog.com",
on_error: Proc.new { |status, msg| print msg },
disabled: Rails.env.test?,
async: true,
)

class ApplicationController < ActionController::Base
layout 'application'

before_action :authenticate_user!
before_action :complete_signup_profile
before_action :check_if_password_expired
before_action :init_posthog

fine_print_require :general_terms_of_use, :privacy_policy, unless: :disable_fine_print

Expand Down Expand Up @@ -45,9 +36,19 @@ def return_url_specified_and_allowed?

include Lev::HandleWith

def init_posthog
return if Rails.env.test?
require 'posthog-ruby'
@posthog = PostHog::Client.new({
api_key: Rails.application.secrets.posthog_project_api_key,
host: "https://us.i.posthog.com",
on_error: Proc.new { |status, msg| print msg }
})
end

def log_posthog(user, event)
return if user.nil? or Rails.env.test?
begin
# begin
@posthog.capture({
distinct_id: user.uuid,
event: event,
Expand All @@ -65,9 +66,9 @@ def log_posthog(user, event)
}
}
})
rescue StandardError => e
Rails.logger.error("PostHog tracking error: #{e.message}")
end
# rescue StandardError => e
# Rails.logger.error("PostHog tracking error: #{e.message}")
# end
end

respond_to :html
Expand Down
2 changes: 1 addition & 1 deletion app/views/newflow/base/profile_newflow.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
role: "<%= current_user&.role %>",
school: "<%= current_user&.school&.name %>",
recent_authentication_provider: "<%= current_user&.authentications&.last&.provider %>",
authentication_method_count: <%= current_user&.authentications&.count || 0 %>,
authentication_method_count: "<%= current_user&.authentications&.count %>",
salesforce_contact_id: "<%= current_user&.salesforce_contact_id %>",
salesforce_lead_id: "<%= current_user&.salesforce_lead_id %>"
}
Expand Down

0 comments on commit 05d9922

Please sign in to comment.