diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-03-01 15:42:04 +0100 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-03-06 12:53:14 +0100 |
commit | 43b74afd8656df8228c19d5e5e6aee9f87abc244 (patch) | |
tree | c1f4a7b09d53af65ed13774e30f2a27be38c8052 /app | |
parent | 986f470d40a3ed993bb6b2c2115a05c24eb575fa (diff) | |
download | gitlab-ce-43b74afd8656df8228c19d5e5e6aee9f87abc244.tar.gz |
Rename to UserInteractedProjects.
This is to avoid a mix-up with the existing concept of 'user
contributions'. See `User#contributed_projects` or
`Event#contributions`.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/event.rb | 6 | ||||
-rw-r--r-- | app/models/user_interacted_projects.rb (renamed from app/models/user_contributed_projects.rb) | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index e855ed02274..166c3f1b4b1 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -65,7 +65,7 @@ class Event < ActiveRecord::Base # Callbacks after_create :reset_project_activity after_create :set_last_repository_updated_at, if: :push? - after_create :track_user_contributed_projects + after_create :track_user_interacted_projects # Scopes scope :recent, -> { reorder(id: :desc) } @@ -391,10 +391,10 @@ class Event < ActiveRecord::Base .update_all(last_repository_updated_at: created_at) end - def track_user_contributed_projects + def track_user_interacted_projects # Note the call to .available? is due to earlier migrations # that would otherwise conflict with the call to .track # (because the table does not exist yet). - UserContributedProjects.track(self) if UserContributedProjects.available? + UserInteractedProjects.track(self) if UserInteractedProjects.available? end end diff --git a/app/models/user_contributed_projects.rb b/app/models/user_interacted_projects.rb index 624d41e3526..ba6ed2bd2ff 100644 --- a/app/models/user_contributed_projects.rb +++ b/app/models/user_interacted_projects.rb @@ -1,4 +1,4 @@ -class UserContributedProjects < ActiveRecord::Base +class UserInteractedProjects < ActiveRecord::Base belongs_to :user belongs_to :project @@ -52,7 +52,7 @@ class UserContributedProjects < ActiveRecord::Base private def cached_exists?(project_id:, user_id:, &block) - cache_key = "user_contributed_projects:#{project_id}:#{user_id}" + cache_key = "user_interacted_projects:#{project_id}:#{user_id}" Rails.cache.fetch(cache_key, expires_in: CACHE_EXPIRY_TIME, &block) end end |