show who merged request

This commit is contained in:
Dmitriy Zaporozhets 2012-03-15 23:32:00 +02:00
parent 828f84fdb3
commit 7b75f3cfd3
3 changed files with 16 additions and 1 deletions

View file

@ -68,6 +68,10 @@ class MergeRequest < ActiveRecord::Base
commits.first
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)
def upvotes
notes.select(&:upvote?).size

View file

@ -99,7 +99,8 @@ class Project < ActiveRecord::Base
Event.create(
:project => self,
:action => Event::Merged,
:data => {:merge_request_id => merge_request.id},
:target_id => merge_request.id,
:target_type => "MergeRequest",
:author_id => user.id
)
end

View file

@ -28,6 +28,16 @@
%hr
- if @merge_request.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
.alert-message.success
= link_to "#", :class => "info_link", :title => "How To Merge" do