summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 14:20:26 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 15:55:28 -0800
commit8bf7a64b5fc948cf19855dfcb9e5e08ab24a7caa (patch)
tree89282c9fd05518b6331b15cb190734e93f2bd3b3
parent87bf35df95ea4aad8a970a1d7a90e23557acc3ae (diff)
downloadgitlab-ce-8bf7a64b5fc948cf19855dfcb9e5e08ab24a7caa.tar.gz
Get contributed projects only if push event exists
Conflicts: app/models/user.rb
-rw-r--r--app/models/user.rb12
-rw-r--r--app/views/users/calendar.html.haml2
2 files changed, 11 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index d4018f0c897..f1fa094ce69 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -255,7 +255,7 @@ class User < ActiveRecord::Base
counter = 0
base = username
while User.by_login(username).present? || Namespace.by_path(username).present?
- counter += 1
+ counter += 1
username = "#{base}#{counter}"
end
@@ -459,7 +459,7 @@ class User < ActiveRecord::Base
def set_notification_email
if self.notification_email.blank? || !self.all_emails.include?(self.notification_email)
- self.notification_email = self.email
+ self.notification_email = self.email
end
end
@@ -607,4 +607,12 @@ class User < ActiveRecord::Base
def oauth_authorized_tokens
Doorkeeper::AccessToken.where(resource_owner_id: self.id, revoked_at: nil)
end
+
+ def contributed_projects_ids
+ Event.where(author_id: self).
+ code_push.
+ reorder(project_id: :desc).
+ select('DISTINCT(project_id)').
+ map(&:project_id)
+ end
end
diff --git a/app/views/users/calendar.html.haml b/app/views/users/calendar.html.haml
index 13bdc5ed1e7..1d1c974da24 100644
--- a/app/views/users/calendar.html.haml
+++ b/app/views/users/calendar.html.haml
@@ -1,4 +1,4 @@
-%h4 Calendar
+%h4 Commits calendar
#cal-heatmap.calendar
:javascript
new calendar(