Commit cd6280f4fe712da9b65a8c62950b71fe93705147
1 parent
ff4471a3
Exists in
master
and in
4 other branches
Use data[:commits] hash from event to render push info on dashboard
Showing
3 changed files
with
9 additions
and
28 deletions
Show diff stats
app/models/event.rb
| ... | ... | @@ -200,7 +200,7 @@ class Event < ActiveRecord::Base |
| 200 | 200 | |
| 201 | 201 | # Max 20 commits from push DESC |
| 202 | 202 | def commits |
| 203 | - @commits ||= data[:commits].map { |commit| repository.commit(commit[:id]) }.reverse | |
| 203 | + @commits ||= data[:commits].reverse | |
| 204 | 204 | end |
| 205 | 205 | |
| 206 | 206 | def commits_count |
| ... | ... | @@ -221,26 +221,8 @@ class Event < ActiveRecord::Base |
| 221 | 221 | end |
| 222 | 222 | end |
| 223 | 223 | |
| 224 | - def repository | |
| 225 | - project.repository | |
| 226 | - end | |
| 227 | - | |
| 228 | - def parent_commit | |
| 229 | - repository.commit(commit_from) | |
| 230 | - rescue => ex | |
| 231 | - nil | |
| 232 | - end | |
| 233 | - | |
| 234 | - def last_commit | |
| 235 | - repository.commit(commit_to) | |
| 236 | - rescue => ex | |
| 237 | - nil | |
| 238 | - end | |
| 239 | - | |
| 240 | 224 | def push_with_commits? |
| 241 | - md_ref? && commits.any? && parent_commit && last_commit | |
| 242 | - rescue Grit::NoSuchPathError | |
| 243 | - false | |
| 225 | + md_ref? && commits.any? && commit_from && commit_to | |
| 244 | 226 | end |
| 245 | 227 | |
| 246 | 228 | def last_push_to_non_root? | ... | ... |
app/views/dashboard/show.atom.builder
| ... | ... | @@ -8,11 +8,10 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear |
| 8 | 8 | |
| 9 | 9 | @events.each do |event| |
| 10 | 10 | if event.proper? |
| 11 | - event = EventDecorator.decorate(event) | |
| 12 | 11 | xml.entry do |
| 13 | - event_link = event.feed_url | |
| 14 | - event_title = event.feed_title | |
| 15 | - event_summary = event.feed_summary | |
| 12 | + event_link = event_feed_url(event) | |
| 13 | + event_title = event_feed_title(event) | |
| 14 | + event_summary = event_feed_summary(event) | |
| 16 | 15 | |
| 17 | 16 | xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}" |
| 18 | 17 | xml.link :href => event_link | ... | ... |
app/views/events/_commit.html.haml
| 1 | 1 | %li.commit |
| 2 | 2 | %p |
| 3 | - = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" | |
| 4 | - %span= commit.author_name | |
| 3 | + = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id" | |
| 4 | + %span= commit[:author][:name] | |
| 5 | 5 | – |
| 6 | - = image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16 | |
| 7 | - = gfm escape_once(truncate(commit.title, length: 50)) rescue "--broken encoding" | |
| 6 | + = image_tag gravatar_icon(commit[:author][:email]), class: "avatar", width: 16 | |
| 7 | + = gfm escape_once(truncate(commit[:message], length: 50)) rescue "--broken encoding" | ... | ... |