summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb6
-rw-r--r--app/models/user.rb7
2 files changed, 10 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 932cfc980a2..2d46b7d7a95 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -48,6 +48,12 @@ class Project < ActiveRecord::Base
default_value_for :wall_enabled, false
default_value_for :snippets_enabled, gitlab_config_features.snippets
+ # set last_activity_at to the same as created_at
+ after_create :set_last_activity_at
+ def set_last_activity_at
+ update_column(:last_activity_at, self.created_at)
+ end
+
ActsAsTaggableOn.strict_case_match = true
acts_as_taggable_on :tags
diff --git a/app/models/user.rb b/app/models/user.rb
index 80bdd47ea0c..73a75df9d11 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -623,9 +623,10 @@ class User < ActiveRecord::Base
def contributed_projects_ids
Event.where(author_id: self).
where("created_at > ?", Time.now - 1.year).
- code_push.
+ where("action = :pushed OR (target_type = 'MergeRequest' AND action = :created)",
+ pushed: Event::PUSHED, created: Event::CREATED).
reorder(project_id: :desc).
- select('DISTINCT(project_id)').
- map(&:project_id)
+ select(:project_id).
+ uniq
end
end