Commit 77d958ec45ac695864f92ce16233546b3a9d39b6

use the commit date

Signed-off-by: David A. Cuadrado <krawek@gmail.com>

Commit diff

app/models/project.rb

 
134134 super({:procs => [info]}.merge(opts))
135135 end
136136
137 def create_event(action_id, target, user, data = nil, body = nil)
138 events.create(:action => action_id, :target => target, :user => user, :body => body, :data => data)
137 def create_event(action_id, target, user, data = nil, body = nil, date = Time.now.utc)
138 events.create(:action => action_id, :target => target, :user => user,
139 :body => body, :data => data, :created_at => date)
139140 end
140141
141142 protected
toggle raw diff

data/hooks/post-receive

 
7979 user_map = users.inject({}) { |hash, user| hash[user.email] = user; hash }
8080
8181 revs.each do |sha1|
82 info = git.show({ :pretty => "format:author: %cn%nemail: %ce%ndate: %cd%nmessage: %s", :s => true}, sha1)
82 info = git.show({ :pretty => "format:author: %cn%nemail: %ce%ndate: %ct%nmessage: %s", :s => true}, sha1)
8383
8484 hash = {}
8585 info.each { |line|
8787 key = $1.to_sym
8888 value = $2
8989
90 value = Date.parse(value) if key == :date
90 value = Time.at(value.to_i).utc if key == :date
9191
9292 hash[key] = value
9393 end
144144 # puts "#{hash[:author]}: #{Action.name(action_id)} #{ref} on #{slug} [#{hash[:date]}]"
145145 # puts " #{hash[:message]}"
146146
147 project.create_event(action_id, repository, user, ref, hash[:message])
147 project.create_event(action_id, repository, user, ref, hash[:message], hash[:date])
148148 end
149149end
150150
toggle raw diff