summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-05 19:47:45 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-05 19:47:45 +0300
commitcd6280f4fe712da9b65a8c62950b71fe93705147 (patch)
tree107c5b784462f350af3b8d88168fa8baa96cf6a6
parentff4471a3cd1d29228a67e582bc54bed952c0a8ee (diff)
downloadgitlab-ce-cd6280f4fe712da9b65a8c62950b71fe93705147.tar.gz
Use data[:commits] hash from event to render push info on dashboard
-rw-r--r--app/models/event.rb22
-rw-r--r--app/views/dashboard/show.atom.builder7
-rw-r--r--app/views/events/_commit.html.haml8
3 files changed, 9 insertions, 28 deletions
diff --git a/app/models/event.rb b/app/models/event.rb
index ae14454c59a..7488b99f434 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -200,7 +200,7 @@ class Event < ActiveRecord::Base
# Max 20 commits from push DESC
def commits
- @commits ||= data[:commits].map { |commit| repository.commit(commit[:id]) }.reverse
+ @commits ||= data[:commits].reverse
end
def commits_count
@@ -221,26 +221,8 @@ class Event < ActiveRecord::Base
end
end
- def repository
- project.repository
- end
-
- def parent_commit
- repository.commit(commit_from)
- rescue => ex
- nil
- end
-
- def last_commit
- repository.commit(commit_to)
- rescue => ex
- nil
- end
-
def push_with_commits?
- md_ref? && commits.any? && parent_commit && last_commit
- rescue Grit::NoSuchPathError
- false
+ md_ref? && commits.any? && commit_from && commit_to
end
def last_push_to_non_root?
diff --git a/app/views/dashboard/show.atom.builder b/app/views/dashboard/show.atom.builder
index 29b2e4a26d8..a913df92299 100644
--- a/app/views/dashboard/show.atom.builder
+++ b/app/views/dashboard/show.atom.builder
@@ -8,11 +8,10 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
@events.each do |event|
if event.proper?
- event = EventDecorator.decorate(event)
xml.entry do
- event_link = event.feed_url
- event_title = event.feed_title
- event_summary = event.feed_summary
+ event_link = event_feed_url(event)
+ event_title = event_feed_title(event)
+ event_summary = event_feed_summary(event)
xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
xml.link :href => event_link
diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml
index f2f2d47ef96..2d80fc103f6 100644
--- a/app/views/events/_commit.html.haml
+++ b/app/views/events/_commit.html.haml
@@ -1,7 +1,7 @@
%li.commit
%p
- = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
- %span= commit.author_name
+ = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id"
+ %span= commit[:author][:name]
&ndash;
- = image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16
- = gfm escape_once(truncate(commit.title, length: 50)) rescue "--broken encoding"
+ = image_tag gravatar_icon(commit[:author][:email]), class: "avatar", width: 16
+ = gfm escape_once(truncate(commit[:message], length: 50)) rescue "--broken encoding"