Skip to content

Initial implementation of public activity #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ gem "flamegraph"

gem "skylight"

gem "public_activity"

# Ahoy analytics
gem "ahoy_matey"
gem "geocoder"
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ GEM
psych (5.2.4)
date
stringio
public_activity (3.0.1)
actionpack (>= 6.1.0)
activerecord (>= 6.1)
i18n (>= 0.5.0)
railties (>= 6.1.0)
public_suffix (6.0.2)
puma (6.6.0)
nio4r (~> 2.0)
Expand Down Expand Up @@ -549,6 +554,7 @@ DEPENDENCIES
paper_trail
pg
propshaft
public_activity
puma (>= 5.0)
query_count
rack-cors
Expand Down
3 changes: 3 additions & 0 deletions app/models/project_repo_mapping.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class ProjectRepoMapping < ApplicationRecord
belongs_to :user

include PublicActivity::Model
tracked

after_save :invalidate_cache

validates :project_name, presence: true
Expand Down
25 changes: 25 additions & 0 deletions db/migrate/20250507161052_create_activities.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

# Migration responsible for creating a table with activities
class CreateActivities < ActiveRecord::Migration[6.1]
def self.up
create_table :activities do |t|
t.belongs_to :trackable, polymorphic: true
t.belongs_to :owner, polymorphic: true
t.string :key
t.text :parameters
t.belongs_to :recipient, polymorphic: true

t.timestamps
end

add_index :activities, %i[trackable_id trackable_type]
add_index :activities, %i[owner_id owner_type]
add_index :activities, %i[recipient_id recipient_type]
end

# Drop table
def self.down
drop_table :activities
end
end
21 changes: 20 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading