diff --git a/app/controllers/api/hackatime/v1/hackatime_controller.rb b/app/controllers/api/hackatime/v1/hackatime_controller.rb index 8b3d056c..1127bbba 100644 --- a/app/controllers/api/hackatime/v1/hackatime_controller.rb +++ b/app/controllers/api/hackatime/v1/hackatime_controller.rb @@ -280,7 +280,8 @@ def queue_project_mapping(project_name) def queue_heartbeat_public_activity(user_id, project_name) # only queue the job once per minute Rails.cache.fetch("heartbeat_public_activity_#{user_id}_#{project_name}", expires_in: 30.seconds) do - CreateHeartbeatActivityJob.perform_later(user_id, project_name) + # temporarily disable + # CreateHeartbeatActivityJob.perform_later(user_id, project_name) end rescue => e # never raise an error here because it will break the heartbeat flow diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b8e0a951..e186373b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,7 +22,7 @@ def switch_time_zone(&block) def set_public_activity return unless Flipper.enabled?(:public_activity_log, current_user) - @activities = PublicActivity::Activity.all + @activities = PublicActivity::Activity.limit(25).order(created_at: :desc).includes(:owner, :trackable) end def honeybadger_context diff --git a/app/jobs/create_heartbeat_activity_job.rb b/app/jobs/create_heartbeat_activity_job.rb index 6b3da33d..13b94bc9 100644 --- a/app/jobs/create_heartbeat_activity_job.rb +++ b/app/jobs/create_heartbeat_activity_job.rb @@ -6,7 +6,7 @@ def perform(user_id, project_name) # Look for future coding activity only (not past events that are already showing) recent_activity = PublicActivity::Activity.with_future - .where(owner_id: user_id, trackable_type: "Heartbeat", key: "coding_session") + .where(owner_id: user_id, trackable_type: "User", key: "user.coding_session") .where("created_at > ?", Time.current) .first @@ -31,7 +31,7 @@ def perform(user_id, project_name) PublicActivity::Activity.create!( trackable: user, owner: user, - key: "started_working", + key: "user.started_working", parameters: { project: project_name } ) @@ -40,7 +40,7 @@ def perform(user_id, project_name) activity = PublicActivity::Activity.create!( trackable: user, owner: user, - key: "coding_session", + key: "user.coding_session", parameters: { project: project_name, started_at: started_at, @@ -55,7 +55,7 @@ def perform(user_id, project_name) PublicActivity::Activity.create!( trackable: user, owner: user, - key: "first_heartbeat", + key: "user.first_heartbeat", parameters: { project: project_name } ) end diff --git a/app/views/public_activity/heartbeat/_coding_session.html.erb b/app/views/public_activity/user/_coding_session.html.erb similarity index 100% rename from app/views/public_activity/heartbeat/_coding_session.html.erb rename to app/views/public_activity/user/_coding_session.html.erb diff --git a/app/views/public_activity/heartbeat/_first_heartbeat.html.erb b/app/views/public_activity/user/_first_heartbeat.html.erb similarity index 100% rename from app/views/public_activity/heartbeat/_first_heartbeat.html.erb rename to app/views/public_activity/user/_first_heartbeat.html.erb diff --git a/app/views/public_activity/heartbeat/_started_working.html.erb b/app/views/public_activity/user/_started_working.html.erb similarity index 100% rename from app/views/public_activity/heartbeat/_started_working.html.erb rename to app/views/public_activity/user/_started_working.html.erb