Commit f088eaa972ae3bc3beddb85adb98d185ea8a2ddc
1 parent
7fa6a234
Exists in
master
and in
4 other branches
Refactoring & minor css changes
Showing
7 changed files
with
125 additions
and
108 deletions
Show diff stats
CHANGELOG
@@ -3,6 +3,11 @@ v 2.8.0 | @@ -3,6 +3,11 @@ v 2.8.0 | ||
3 | - Bulk issues update | 3 | - Bulk issues update |
4 | - Issues API | 4 | - Issues API |
5 | - Cucumber coverage increased | 5 | - Cucumber coverage increased |
6 | + - Post-receive files fixed | ||
7 | + - UI improved | ||
8 | + - Application cleanup | ||
9 | + - more cucumber | ||
10 | + - capybara-webkit + headless | ||
6 | 11 | ||
7 | v 2.7.0 | 12 | v 2.7.0 |
8 | - Issue Labels | 13 | - Issue Labels |
app/assets/stylesheets/gitlab_bootstrap.scss
@@ -330,16 +330,20 @@ img.avatar { | @@ -330,16 +330,20 @@ img.avatar { | ||
330 | float:left; | 330 | float:left; |
331 | margin-right:15px; | 331 | margin-right:15px; |
332 | width:40px; | 332 | width:40px; |
333 | - border:2px solid #ddd; | 333 | + border:1px solid #ddd; |
334 | + padding:1px; | ||
334 | 335 | ||
335 | &.s16 { | 336 | &.s16 { |
336 | width:16px; | 337 | width:16px; |
338 | + height:16px; | ||
337 | } | 339 | } |
338 | &.s24 { | 340 | &.s24 { |
339 | width:24px; | 341 | width:24px; |
342 | + height:24px; | ||
340 | } | 343 | } |
341 | &.s32 { | 344 | &.s32 { |
342 | width:32px; | 345 | width:32px; |
346 | + height:32px; | ||
343 | } | 347 | } |
344 | } | 348 | } |
345 | 349 |
app/assets/stylesheets/themes/ui_mars.scss
@@ -20,6 +20,10 @@ | @@ -20,6 +20,10 @@ | ||
20 | 20 | ||
21 | .fbtn { | 21 | .fbtn { |
22 | .btn { | 22 | .btn { |
23 | + i { | ||
24 | + position: relative; | ||
25 | + top: 1px; | ||
26 | + } | ||
23 | margin-left:8px; | 27 | margin-left:8px; |
24 | background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #595D63), to(#31363E)); | 28 | background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #595D63), to(#31363E)); |
25 | background-image: -webkit-linear-gradient(#595D63 6.6%, #31363E); | 29 | background-image: -webkit-linear-gradient(#595D63 6.6%, #31363E); |
@@ -32,6 +36,10 @@ | @@ -32,6 +36,10 @@ | ||
32 | background-image: -moz-linear-gradient(#595D63 6.6%, #202227); | 36 | background-image: -moz-linear-gradient(#595D63 6.6%, #202227); |
33 | background-image: -o-linear-gradient(#595D63 6.6%, #202227); | 37 | background-image: -o-linear-gradient(#595D63 6.6%, #202227); |
34 | background-position:0 0; | 38 | background-position:0 0; |
39 | + color:#fff; | ||
40 | + i { | ||
41 | + @extend .icon-white; | ||
42 | + } | ||
35 | } | 43 | } |
36 | 44 | ||
37 | border: 1px solid #31363E; | 45 | border: 1px solid #31363E; |
app/models/project.rb
@@ -2,7 +2,7 @@ require "grit" | @@ -2,7 +2,7 @@ require "grit" | ||
2 | 2 | ||
3 | class Project < ActiveRecord::Base | 3 | class Project < ActiveRecord::Base |
4 | include Repository | 4 | include Repository |
5 | - include ProjectPush | 5 | + include PushObserver |
6 | include Authority | 6 | include Authority |
7 | include Team | 7 | include Team |
8 | 8 |
app/roles/project_push.rb
@@ -1,105 +0,0 @@ | @@ -1,105 +0,0 @@ | ||
1 | -module ProjectPush | ||
2 | - def observe_push(oldrev, newrev, ref, user) | ||
3 | - data = post_receive_data(oldrev, newrev, ref, user) | ||
4 | - | ||
5 | - Event.create( | ||
6 | - project: self, | ||
7 | - action: Event::Pushed, | ||
8 | - data: data, | ||
9 | - author_id: data[:user_id] | ||
10 | - ) | ||
11 | - end | ||
12 | - | ||
13 | - def update_merge_requests(oldrev, newrev, ref, user) | ||
14 | - return true unless ref =~ /heads/ | ||
15 | - branch_name = ref.gsub("refs/heads/", "") | ||
16 | - c_ids = self.commits_between(oldrev, newrev).map(&:id) | ||
17 | - | ||
18 | - # Update code for merge requests | ||
19 | - mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all | ||
20 | - mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } | ||
21 | - | ||
22 | - # Close merge requests | ||
23 | - mrs = self.merge_requests.opened.where(target_branch: branch_name).all | ||
24 | - mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) } | ||
25 | - mrs.each { |merge_request| merge_request.merge!(user.id) } | ||
26 | - | ||
27 | - true | ||
28 | - end | ||
29 | - | ||
30 | - def execute_hooks(oldrev, newrev, ref, user) | ||
31 | - ref_parts = ref.split('/') | ||
32 | - | ||
33 | - # Return if this is not a push to a branch (e.g. new commits) | ||
34 | - return if ref_parts[1] !~ /heads/ || oldrev == "00000000000000000000000000000000" | ||
35 | - | ||
36 | - data = post_receive_data(oldrev, newrev, ref, user) | ||
37 | - | ||
38 | - hooks.each { |hook| hook.execute(data) } | ||
39 | - end | ||
40 | - | ||
41 | - def post_receive_data(oldrev, newrev, ref, user) | ||
42 | - | ||
43 | - push_commits = commits_between(oldrev, newrev) | ||
44 | - | ||
45 | - # Total commits count | ||
46 | - push_commits_count = push_commits.size | ||
47 | - | ||
48 | - # Get latest 20 commits ASC | ||
49 | - push_commits_limited = push_commits.last(20) | ||
50 | - | ||
51 | - # Hash to be passed as post_receive_data | ||
52 | - data = { | ||
53 | - before: oldrev, | ||
54 | - after: newrev, | ||
55 | - ref: ref, | ||
56 | - user_id: user.id, | ||
57 | - user_name: user.name, | ||
58 | - repository: { | ||
59 | - name: name, | ||
60 | - url: web_url, | ||
61 | - description: description, | ||
62 | - homepage: web_url, | ||
63 | - }, | ||
64 | - commits: [], | ||
65 | - total_commits_count: push_commits_count | ||
66 | - } | ||
67 | - | ||
68 | - # For perfomance purposes maximum 20 latest commits | ||
69 | - # will be passed as post receive hook data. | ||
70 | - # | ||
71 | - push_commits_limited.each do |commit| | ||
72 | - data[:commits] << { | ||
73 | - id: commit.id, | ||
74 | - message: commit.safe_message, | ||
75 | - timestamp: commit.date.xmlschema, | ||
76 | - url: "#{Gitlab.config.url}/#{code}/commits/#{commit.id}", | ||
77 | - author: { | ||
78 | - name: commit.author_name, | ||
79 | - email: commit.author_email | ||
80 | - } | ||
81 | - } | ||
82 | - end | ||
83 | - | ||
84 | - data | ||
85 | - end | ||
86 | - | ||
87 | - | ||
88 | - # This method will be called after each post receive | ||
89 | - # and only if user present in gitlab. | ||
90 | - # All callbacks for post receive should be placed here | ||
91 | - # | ||
92 | - def trigger_post_receive(oldrev, newrev, ref, user) | ||
93 | - # Create push event | ||
94 | - self.observe_push(oldrev, newrev, ref, user) | ||
95 | - | ||
96 | - # Close merged MR | ||
97 | - self.update_merge_requests(oldrev, newrev, ref, user) | ||
98 | - | ||
99 | - # Execute web hooks | ||
100 | - self.execute_hooks(oldrev, newrev, ref, user) | ||
101 | - | ||
102 | - # Create satellite | ||
103 | - self.satellite.create unless self.satellite.exists? | ||
104 | - end | ||
105 | -end |
@@ -0,0 +1,105 @@ | @@ -0,0 +1,105 @@ | ||
1 | +module PushObserver | ||
2 | + def observe_push(oldrev, newrev, ref, user) | ||
3 | + data = post_receive_data(oldrev, newrev, ref, user) | ||
4 | + | ||
5 | + Event.create( | ||
6 | + project: self, | ||
7 | + action: Event::Pushed, | ||
8 | + data: data, | ||
9 | + author_id: data[:user_id] | ||
10 | + ) | ||
11 | + end | ||
12 | + | ||
13 | + def update_merge_requests(oldrev, newrev, ref, user) | ||
14 | + return true unless ref =~ /heads/ | ||
15 | + branch_name = ref.gsub("refs/heads/", "") | ||
16 | + c_ids = self.commits_between(oldrev, newrev).map(&:id) | ||
17 | + | ||
18 | + # Update code for merge requests | ||
19 | + mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all | ||
20 | + mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } | ||
21 | + | ||
22 | + # Close merge requests | ||
23 | + mrs = self.merge_requests.opened.where(target_branch: branch_name).all | ||
24 | + mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) } | ||
25 | + mrs.each { |merge_request| merge_request.merge!(user.id) } | ||
26 | + | ||
27 | + true | ||
28 | + end | ||
29 | + | ||
30 | + def execute_hooks(oldrev, newrev, ref, user) | ||
31 | + ref_parts = ref.split('/') | ||
32 | + | ||
33 | + # Return if this is not a push to a branch (e.g. new commits) | ||
34 | + return if ref_parts[1] !~ /heads/ || oldrev == "00000000000000000000000000000000" | ||
35 | + | ||
36 | + data = post_receive_data(oldrev, newrev, ref, user) | ||
37 | + | ||
38 | + hooks.each { |hook| hook.execute(data) } | ||
39 | + end | ||
40 | + | ||
41 | + def post_receive_data(oldrev, newrev, ref, user) | ||
42 | + | ||
43 | + push_commits = commits_between(oldrev, newrev) | ||
44 | + | ||
45 | + # Total commits count | ||
46 | + push_commits_count = push_commits.size | ||
47 | + | ||
48 | + # Get latest 20 commits ASC | ||
49 | + push_commits_limited = push_commits.last(20) | ||
50 | + | ||
51 | + # Hash to be passed as post_receive_data | ||
52 | + data = { | ||
53 | + before: oldrev, | ||
54 | + after: newrev, | ||
55 | + ref: ref, | ||
56 | + user_id: user.id, | ||
57 | + user_name: user.name, | ||
58 | + repository: { | ||
59 | + name: name, | ||
60 | + url: web_url, | ||
61 | + description: description, | ||
62 | + homepage: web_url, | ||
63 | + }, | ||
64 | + commits: [], | ||
65 | + total_commits_count: push_commits_count | ||
66 | + } | ||
67 | + | ||
68 | + # For perfomance purposes maximum 20 latest commits | ||
69 | + # will be passed as post receive hook data. | ||
70 | + # | ||
71 | + push_commits_limited.each do |commit| | ||
72 | + data[:commits] << { | ||
73 | + id: commit.id, | ||
74 | + message: commit.safe_message, | ||
75 | + timestamp: commit.date.xmlschema, | ||
76 | + url: "#{Gitlab.config.url}/#{code}/commits/#{commit.id}", | ||
77 | + author: { | ||
78 | + name: commit.author_name, | ||
79 | + email: commit.author_email | ||
80 | + } | ||
81 | + } | ||
82 | + end | ||
83 | + | ||
84 | + data | ||
85 | + end | ||
86 | + | ||
87 | + | ||
88 | + # This method will be called after each post receive | ||
89 | + # and only if user present in gitlab. | ||
90 | + # All callbacks for post receive should be placed here | ||
91 | + # | ||
92 | + def trigger_post_receive(oldrev, newrev, ref, user) | ||
93 | + # Create push event | ||
94 | + self.observe_push(oldrev, newrev, ref, user) | ||
95 | + | ||
96 | + # Close merged MR | ||
97 | + self.update_merge_requests(oldrev, newrev, ref, user) | ||
98 | + | ||
99 | + # Execute web hooks | ||
100 | + self.execute_hooks(oldrev, newrev, ref, user) | ||
101 | + | ||
102 | + # Create satellite | ||
103 | + self.satellite.create unless self.satellite.exists? | ||
104 | + end | ||
105 | +end |
app/views/team_members/_show.html.haml
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | %span.label Blocked | 9 | %span.label Blocked |
10 | 10 | ||
11 | = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do | 11 | = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do |
12 | - = image_tag gravatar_icon(user.email, 40), class: "avatar" | 12 | + = image_tag gravatar_icon(user.email, 40), class: "avatar s32" |
13 | = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do | 13 | = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do |
14 | %strong= truncate(user.name, lenght: 40) | 14 | %strong= truncate(user.name, lenght: 40) |
15 | %br | 15 | %br |