Fix wall notes event trying to render target

This commit is contained in:
Dmitriy Zaporozhets 2012-12-16 19:52:39 +02:00
parent 592412992d
commit 5058c4fdcf
2 changed files with 16 additions and 2 deletions

View file

@ -18,4 +18,16 @@ module NoteEvent
def note_target_id
target.noteable_id
end
def wall_note?
target.noteable_type.blank?
end
def note_target_type
if target.noteable_type.present?
target.noteable_type.titleize
else
"Wall"
end.downcase
end
end

View file

@ -1,13 +1,15 @@
.event-title
%span.author_name= link_to_author event
%span.event_label commented on #{event.target.noteable_type_name}
- if event.target and event.note_target
%span.event_label commented on #{event.note_target_type}
- if event.note_target
- if event.note_commit?
= link_to event.note_short_commit_id, project_commit_path(event.project, event.note_commit_id), class: "commit_short_id"
- else
= link_to [event.project, event.note_target] do
%strong= truncate event.note_target_id
- elsif event.wall_note?
-# nothing here
- else
%strong (deleted)
at