diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-03-18 17:47:02 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-03-18 17:47:02 +0000 |
commit | fec5f807bb4b89c22e0e8ea820ea462f15f14165 (patch) | |
tree | 38c8bf5af78ef4f740bc2f840db1f9aba870ed66 /lib | |
parent | 1646bfc273458440a2f027b04ab49ebbb8b441ed (diff) | |
parent | 9d938fd77da033f09530571a6194609aee8bbc7b (diff) | |
download | gitlab-ce-fec5f807bb4b89c22e0e8ea820ea462f15f14165.tar.gz |
Merge branch 'new-branch-commits' into 'master'
List new commits for newly pushed branch in activity view.
When someone pushes commits, I want to see them, regardless if it's a new or existing branch. If it's a new branch, we compare with the default branch (usually master).
![Screen_Shot_2015-03-17_at_15.49.13](https://dev.gitlab.org/gitlab/gitlabhq/uploads/4cb7e0d833bc83a30197db81d4b273bc/Screen_Shot_2015-03-17_at_15.49.13.png)
See merge request !1711
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/push_data_builder.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb index ea9012b8844..694a30db5df 100644 --- a/lib/gitlab/push_data_builder.rb +++ b/lib/gitlab/push_data_builder.rb @@ -27,6 +27,12 @@ module Gitlab # Get latest 20 commits ASC commits_limited = commits.last(20) + + # For performance purposes maximum 20 latest commits + # will be passed as post receive hook data. + commit_attrs = commits_limited.map do |commit| + commit.hook_attrs(project) + end type = Gitlab::Git.tag_ref?(ref) ? "tag_push" : "push" # Hash to be passed as post_receive_data @@ -49,17 +55,10 @@ module Gitlab git_ssh_url: project.ssh_url_to_repo, visibility_level: project.visibility_level }, - commits: [], + commits: commit_attrs, total_commits_count: commits_count } - # For performance purposes maximum 20 latest commits - # will be passed as post receive hook data. - commits_limited.each do |commit| - data[:commits] << commit.hook_attrs(project) - end - - data[:commits] = "" if data[:commits].count == 0 data end |