Commit 7b75f3cf authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

show who merged request

parent 828f84fd
...@@ -68,6 +68,10 @@ class MergeRequest < ActiveRecord::Base ...@@ -68,6 +68,10 @@ class MergeRequest < ActiveRecord::Base
commits.first commits.first
end end
def merge_event
self.project.events.where(:target_id => self.id, :target_type => "MergeRequest", :action => Event::Merged).last
end
# Return the number of +1 comments (upvotes) # Return the number of +1 comments (upvotes)
def upvotes def upvotes
notes.select(&:upvote?).size notes.select(&:upvote?).size
......
...@@ -99,7 +99,8 @@ class Project < ActiveRecord::Base ...@@ -99,7 +99,8 @@ class Project < ActiveRecord::Base
Event.create( Event.create(
:project => self, :project => self,
:action => Event::Merged, :action => Event::Merged,
:data => {:merge_request_id => merge_request.id}, :target_id => merge_request.id,
:target_type => "MergeRequest",
:author_id => user.id :author_id => user.id
) )
end end
......
...@@ -28,6 +28,16 @@ ...@@ -28,6 +28,16 @@
%hr %hr
- if @merge_request.closed - if @merge_request.closed
.alert-message.error Closed .alert-message.error Closed
- if @merge_request.merged
- event = @merge_request.merge_event
%div
%p
%strong #{event.author_name}
merged this request
%span.cgray
= time_ago_in_words(event.created_at)
ago.
%br
- else - else
.alert-message.success .alert-message.success
= link_to "#", :class => "info_link", :title => "How To Merge" do = link_to "#", :class => "info_link", :title => "How To Merge" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment